OSDN Git Service

gcc/testsuite/ChangeLog
authorfabien <fabien@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Dec 2011 22:04:40 +0000 (22:04 +0000)
committerfabien <fabien@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Dec 2011 22:04:40 +0000 (22:04 +0000)
2011-12-05  Fabien Chene  <fabien@gcc.gnu.org>

PR c++/51319
* g++.dg/lookup/using50.C: New.
* g++.dg/lookup/using51.C: New.

gcc/cp/ChangeLog

2011-12-05  Fabien Chene  <fabien@gcc.gnu.org>

PR c++/51319
* semantics.c (finish_id_expression): Strip using declarations
early in the function.

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

gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/using50.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lookup/using51.C [new file with mode: 0644]

index cca601d..9a1043a 100644 (file)
@@ -2893,6 +2893,8 @@ finish_id_expression (tree id_expression,
                      const char **error_msg,
                      location_t location)
 {
+  decl = strip_using_decl (decl);
+
   /* Initialize the output parameters.  */
   *idk = CP_ID_KIND_NONE;
   *error_msg = NULL;
index efb2ed4..12709b7 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-05  Fabien ChĂȘne  <fabien@gcc.gnu.org>
+
+       PR c++/51319
+       * g++.dg/lookup/using50.C: New.
+       * g++.dg/lookup/using51.C: New.
+
 2011-12-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/51396
diff --git a/gcc/testsuite/g++.dg/lookup/using50.C b/gcc/testsuite/g++.dg/lookup/using50.C
new file mode 100644 (file)
index 0000000..d525a47
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/51319
+// { dg-do compile }
+
+template<int> struct X {};
+
+struct Base 
+{
+    enum { a = 1 };
+};
+
+struct Der : Base 
+{
+    using Base::a;
+    typedef X<(int)a> Y;
+};
diff --git a/gcc/testsuite/g++.dg/lookup/using51.C b/gcc/testsuite/g++.dg/lookup/using51.C
new file mode 100644 (file)
index 0000000..8438f7f
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/51382
+// { dg-do compile }
+
+template< int Value >
+struct Base
+{
+   enum { b_e = Value };
+};
+
+template< typename Type >
+struct Derived : Type
+{
+   Type::b_e;
+   enum { d_e = b_e };
+};
+
+int v = (int)Derived< Base< 3 > >::d_e;