From 0f19e7adef3f2818fd0b363306791c23b0656b62 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 14 Apr 2015 11:29:34 -0400 Subject: [PATCH] re PR c++/65721 (Internal compiler error segmentation fault) PR c++/65721 * name-lookup.c (do_class_using_decl): Complain about specifying the current class even if there are dependent bases. From-SVN: r222096 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/name-lookup.c | 2 +- gcc/testsuite/g++.dg/lookup/using55.C | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/lookup/using55.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 10df58f0bee..03f6f2a4226 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-04-14 Jason Merrill + + PR c++/65721 + * name-lookup.c (do_class_using_decl): Complain about specifying + the current class even if there are dependent bases. + 2015-04-14 David Krauss PR c++/59766 diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index e3f7cca4436..9e4e0e3adf5 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3408,7 +3408,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 index 00000000000..61098b186fb --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using55.C @@ -0,0 +1,19 @@ +// PR c++/65721 + +template +struct A { + typedef T D; +}; + +template +class B : public A { + using typename B::D; // { dg-error "not a base" } +public: + D echo(D x) { // { dg-error "D" } + return x; + } +}; + +int main() { + B b; +} -- 2.30.2