]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/65721 (Internal compiler error segmentation fault)
authorJason Merrill <jason@redhat.com>
Thu, 23 Apr 2015 13:20:08 +0000 (09:20 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 23 Apr 2015 13:20:08 +0000 (09:20 -0400)
PR c++/65721
* name-lookup.c (do_class_using_decl): Complain about specifying
the current class even if there are dependent bases.

From-SVN: r222363

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/g++.dg/lookup/using55.C [new file with mode: 0644]

index 9239750e4723ec68c7d2cf6ce23490b06f6f2e7a..e8835aea547e34f59e2814f03e2b4c9387f16d20 100644 (file)
@@ -1,3 +1,9 @@
+2015-04-23  Jason Merrill  <jason@redhat.com>
+
+       PR c++/65721
+       * name-lookup.c (do_class_using_decl): Complain about specifying
+       the current class even if there are dependent bases.
+
 2015-01-13  Jason Merrill  <jason@redhat.com>
 
        PR c++/64487
index da167ec415870dba13d377d6a424f6c06166a262..9091e75e23047da3eec66a9a6cfb7c286b251ac7 100644 (file)
@@ -3288,7 +3288,7 @@ do_class_using_decl (tree scope, tree name)
                           tf_warning_or_error);
       if (b_kind < bk_proper_base)
        {
-         if (!bases_dependent_p)
+         if (!bases_dependent_p || b_kind == bk_same_type)
            {
              error_not_base_type (scope, current_class_type);
              return NULL_TREE;
diff --git a/gcc/testsuite/g++.dg/lookup/using55.C b/gcc/testsuite/g++.dg/lookup/using55.C
new file mode 100644 (file)
index 0000000..61098b1
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/65721
+
+template<typename T>
+struct A {
+  typedef T D;
+};
+
+template<typename X>
+class B : public A<X> {
+  using typename B::D;         // { dg-error "not a base" }
+public:
+  D echo(D x) {                        // { dg-error "D" }
+    return x;
+  }
+};
+
+int main() {
+  B<int> b;
+}