gcc/cp/
authorsimartin <simartin@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Jun 2009 05:37:17 +0000 (05:37 +0000)
committersimartin <simartin@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Jun 2009 05:37:17 +0000 (05:37 +0000)
2009-06-02  Simon Martin  <simartin@users.sourceforge.net>

PR c++/38089
* pt.c (register_specialization): Properly setup DECL_CONTEXT for
specializations in an invalid namespace.

gcc/testsuite/

2009-06-02  Simon Martin  <simartin@users.sourceforge.net>

PR c++/38089
* g++.dg/template/spec36.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148069 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/spec36.C [new file with mode: 0644]

index 2aee908..33fbcef 100644 (file)
@@ -1,3 +1,9 @@
+2009-06-02  Simon Martin  <simartin@users.sourceforge.net>
+
+       PR c++/38089
+       * pt.c (register_specialization): Properly setup DECL_CONTEXT for
+       specializations in an invalid namespace.
+
 2009-06-01  Aldy Hernandez  <aldyh@redhat.com>
 
        * error.c (print_instantiation_partial_context): Print column
index 72ea5b2..38e930b 100644 (file)
@@ -1316,7 +1316,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend)
      template it is specializing.  */
   if (DECL_TEMPLATE_SPECIALIZATION (spec)
       && !check_specialization_namespace (tmpl))
-    DECL_CONTEXT (spec) = FROB_CONTEXT (decl_namespace_context (tmpl));
+    DECL_CONTEXT (spec) = DECL_CONTEXT (tmpl);
 
   if (!optimize_specialization_lookup_p (tmpl))
     DECL_TEMPLATE_SPECIALIZATIONS (tmpl)
index f76815a..8ace60f 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-02  Simon Martin  <simartin@users.sourceforge.net>
+
+       PR c++/38089
+       * g++.dg/template/spec36.C: New test.
+
 2009-06-01  Ian Lance Taylor  <iant@google.com>
 
        * gcc.dg/cast-qual-3.c: New testcase.
diff --git a/gcc/testsuite/g++.dg/template/spec36.C b/gcc/testsuite/g++.dg/template/spec36.C
new file mode 100644 (file)
index 0000000..71ff3a5
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR c++/38089 */
+/* { dg-do "compile" } */
+
+struct basic_string
+{
+  basic_string(const int __s);
+};
+namespace MyNS {
+  class MyClass {
+    template <typename T>
+    T test() { } /* { dg-error "from definition" } */
+  };
+}
+template <>
+basic_string MyNS::MyClass::test() /* { dg-error "specialization of" } */
+{ return 1; }