summaryrefslogtreecommitdiffstats
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-10 09:02:06 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-10 09:02:06 +0000
commite8d95fdc2b9c6130544b04b13ffb303b0e611c42 (patch)
tree76650e1120092ea70d8d68f3ac66639be6583a19 /gcc/cp/decl2.c
parent09e3106823e9903c9520609b9c705f42d5ef0762 (diff)
downloadppe42-gcc-e8d95fdc2b9c6130544b04b13ffb303b0e611c42.tar.gz
ppe42-gcc-e8d95fdc2b9c6130544b04b13ffb303b0e611c42.zip
cp:
PR c++ 9483 * class.c (check_field_decls): Pass DECL_NAME to constructor_name_p. * decl2.c (constructor_name_p): Avoid repeated constructor_name calls. * decl.c (grokdeclarator): Refactor ctor/dtor detection. testsuite: PR c++ 9483 * g++.dg/other/field1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69180 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index c77e5039fb9..9a0185bd75e 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1190,8 +1190,21 @@ constructor_name (tree type)
bool
constructor_name_p (tree name, tree type)
{
- return (name == constructor_name (type)
- || name == constructor_name_full (type));
+ tree ctor_name;
+
+ if (!name)
+ return false;
+
+ if (TREE_CODE (name) != IDENTIFIER_NODE)
+ return false;
+
+ ctor_name = constructor_name_full (type);
+ if (name == ctor_name)
+ return true;
+ if (IDENTIFIER_TEMPLATE (ctor_name)
+ && name == IDENTIFIER_TEMPLATE (ctor_name))
+ return true;
+ return false;
}
OpenPOWER on IntegriCloud