re PR c++/11794 (using declaration inside nested class seems ignored)
authorNathan Sidwell <nathan@codesourcery.com>
Sat, 6 Sep 2003 18:37:57 +0000 (18:37 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Sat, 6 Sep 2003 18:37:57 +0000 (18:37 +0000)
cp:
PR c++/11794
* class.c (pushclass): Push dependent using decls for nested
classes of templates too.
testsuite:
PR c++/11794
* g++.dg/parse/using3.C: New test.

From-SVN: r71143

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/using3.C [new file with mode: 0644]

index 944bfd789eecfe292e8d301db6d557e0f9d69525..0e657be9407db4fa0b532c83ffc03148e9199dd7 100644 (file)
@@ -1,3 +1,9 @@
+2003-09-06  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/11794
+       * class.c (pushclass): Push dependent using decls for nested
+       classes of templates too.
+
 2003-09-06  Roger Sayle  <roger@eyesopen.com>
 
        PR c++/11409
index 80765c0d9607f7b79fa3bc66032e503067271c65..d17ff5ad0b72d8d6e49e25d150fa3500c45654a2 100644 (file)
@@ -5466,9 +5466,9 @@ pushclass (tree type)
   if (type != previous_class_type || current_class_depth > 1)
     {
       push_class_decls (type);
-      if (CLASSTYPE_IS_TEMPLATE (type))
+      if (CLASSTYPE_TEMPLATE_INFO (type) && !CLASSTYPE_USE_TEMPLATE (type))
        {
-         /* If we are entering the scope of a template (not a
+         /* If we are entering the scope of a template declaration (not a
             specialization), we need to push all the using decls with
             dependent scope too.  */
          tree fields;
index e3c766c482ed63a307eb77d69e384395bf68b90f..331c00d8cbcb1c0b91a7eb4800aef982e3f155f6 100644 (file)
@@ -1,3 +1,8 @@
+2003-09-06  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/11794
+       * g++.dg/parse/using3.C: New test.
+
 2003-09-06  Roger Sayle  <roger@eyesopen.com>
 
        PR c++/11409
diff --git a/gcc/testsuite/g++.dg/parse/using3.C b/gcc/testsuite/g++.dg/parse/using3.C
new file mode 100644 (file)
index 0000000..c266b68
--- /dev/null
@@ -0,0 +1,22 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 6 Sep 2003 <nathan@codesourcery.com>
+// Origin: stefaandr@hotmail.com
+
+// PR c++/11794. Using decl in nested classes of a template class
+
+template <typename T> struct a
+{
+  struct a1: T
+  {
+    using T::aa;
+    
+    a1() { aa = 5; }
+  };
+};
+struct b { int aa; };
+template <> struct a<int>::a1 { a1 () {} };
+
+a<b>::a1 a_b;
+a<int>::a1 a_i;