From 5ebbb72c205cff26072a2f381a3fe92e26ab8257 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 1 Aug 2018 12:09:33 +0000 Subject: [PATCH] =?utf8?q?re=20PR=20c++/86661=20(g++=20ICE:tree=20check:?= =?utf8?q?=20expected=20tree=20that=20contains=20=E2=80=98decl=20minimal?= =?utf8?q?=E2=80=99=20structure,=20have=20=E2=80=98overload=E2=80=99=20in?= =?utf8?q?=20note=5Fname=5Fdeclared=5Fin=5Fclass,=20at=20cp/class.c:8288)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit /cp 2018-08-01 Paolo Carlini PR c++/86661 * class.c (note_name_declared_in_class): Use location_of in permerror instead of DECL_SOURCE_LOCATION (for OVERLOADs). /testsuite 2018-08-01 Paolo Carlini PR c++/86661 * g++.dg/lookup/name-clash12.C: New. From-SVN: r263207 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/class.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/lookup/name-clash12.C | 9 +++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/lookup/name-clash12.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 503d8b4a433..d66c195131c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-08-01 Paolo Carlini + + PR c++/86661 + * class.c (note_name_declared_in_class): Use location_of in permerror + instead of DECL_SOURCE_LOCATION (for OVERLOADs). + 2018-07-31 Tom de Vries PR debug/86687 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c03a82b44f8..de59831c54e 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -8285,7 +8285,7 @@ note_name_declared_in_class (tree name, tree decl) A name N used in a class S shall refer to the same declaration in its context and when re-evaluated in the completed scope of S. */ - if (permerror (DECL_SOURCE_LOCATION (decl), + if (permerror (location_of (decl), "declaration of %q#D changes meaning of %qD", decl, OVL_NAME (decl))) inform (location_of ((tree) n->value), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7fcc05da6a9..7bf890ae8e1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-08-01 Paolo Carlini + + PR c++/86661 + * g++.dg/lookup/name-clash12.C: New. + 2018-08-01 Richard Biener * gcc.dg/tree-ssa/ssa-fre-68.c: New testcase. diff --git a/gcc/testsuite/g++.dg/lookup/name-clash12.C b/gcc/testsuite/g++.dg/lookup/name-clash12.C new file mode 100644 index 00000000000..07ed8c318cc --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/name-clash12.C @@ -0,0 +1,9 @@ +// PR c++/86661 + +typedef int a; // { dg-message "declared here" } +namespace { +class b { + a c; + template void a(); // { dg-error "changes meaning" } +}; +} -- 2.30.2