From 6e4f01ff4d3224e2f48bcd3ced49bcf12bd83d24 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 13 Feb 2015 23:57:10 +0000 Subject: [PATCH] re PR c++/60894 (Use of redundant struct keyword in function prototype combined with using statement causes compilation error) /cp 2015-02-13 Paolo Carlini PR c++/60894 * decl.c (lookup_and_check_tag): Use strip_using_decl. /testsuite 2015-02-13 Paolo Carlini PR c++/60894 * g++.dg/lookup/using54.C: New. From-SVN: r220702 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 1 + gcc/testsuite/ChangeLog | 7 ++++++- gcc/testsuite/g++.dg/lookup/using54.C | 16 ++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/lookup/using54.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0738e8b7b14..6d21c286686 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-02-13 Paolo Carlini + + PR c++/60894 + * decl.c (lookup_and_check_tag): Use strip_using_decl. + 2015-02-13 Jason Merrill PR c++/65054 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index bc481bfe2f5..67c5ae73e36 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12205,6 +12205,7 @@ lookup_and_check_tag (enum tag_types tag_code, tree name, /* First try ordinary name lookup, ignoring hidden class name injected via friend declaration. */ decl = lookup_name_prefer_type (name, 2); + decl = strip_using_decl (decl); /* If that fails, the name will be placed in the smallest non-class, non-function-prototype scope according to 3.3.1/5. We may already have a hidden name declared as friend in this diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bb13dc15523..f6e5ccc1c3b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-02-13 Paolo Carlini + + PR c++/60894 + * g++.dg/lookup/using54.C: New. + 2015-02-13 Jeff Law PR bootstrap/65060 @@ -17,7 +22,7 @@ 2015-02-13 Jeff Law PR tree-optimization/64823 - gcc.dg/uninit-20.c: New test. + * gcc.dg/uninit-20.c: New test. PR rtl-optimization/47477 * gcc.dg/tree-ssa/pr47477.c: New test. diff --git a/gcc/testsuite/g++.dg/lookup/using54.C b/gcc/testsuite/g++.dg/lookup/using54.C new file mode 100644 index 00000000000..680bdadaa26 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/using54.C @@ -0,0 +1,16 @@ +// PR c++/60894 + +struct B +{ + struct S {}; +}; + +struct D : B +{ + using B::S; + void doIt(struct S&); +}; + +void D::doIt(struct S&) +{ +} -- 2.30.2