aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-01-28 17:36:11 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2003-01-28 17:36:11 +0000
commitf2ce60b88d09c376e9862b78e5d37045b2e92351 (patch)
tree6b16cc4f776bde31d9b1c094a319842c484192b3 /gcc
parentf42aadd8561dc4c3da4843536a5f9a0af142c26d (diff)
downloadgcc-f2ce60b88d09c376e9862b78e5d37045b2e92351.zip
gcc-f2ce60b88d09c376e9862b78e5d37045b2e92351.tar.gz
gcc-f2ce60b88d09c376e9862b78e5d37045b2e92351.tar.bz2
re PR c++/3902 ([parser] ambiguous 8.2/7)
cp: PR c++/3902 * parser.c (cp_parser_decl_specifier_seq): Cannot have constructor inside a declarator. testsuite: PR c++/3902 * g++.dg/parse/template5.C: New test. From-SVN: r61987
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/template5.C19
4 files changed, 32 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 180fccb..09445a06 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2003-01-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/3902
+ * parser.c (cp_parser_decl_specifier_seq): Cannot have constructor
+ inside a declarator.
+
2003-01-27 Nathan Sidwell <nathan@codesourcery.com>
* class.c (update_vtable_entry_for_fn): Add index parameter.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7e172ab..1561f4c 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -6518,8 +6518,8 @@ cp_parser_decl_specifier_seq (cp_parser* parser,
{
tree decl_specs = NULL_TREE;
bool friend_p = false;
- bool constructor_possible_p = true;
-
+ bool constructor_possible_p = !parser->in_declarator_p;
+
/* Assume no class or enumeration type is declared. */
*declares_class_or_enum = false;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index dcf4842..cc38d83 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-01-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/3902
+ * g++.dg/parse/template5.C: New test.
+
2003-01-28 Toon Moene <toon@moene.indiv.nluug.nl>
PR fortran/9258
diff --git a/gcc/testsuite/g++.dg/parse/template5.C b/gcc/testsuite/g++.dg/parse/template5.C
new file mode 100644
index 0000000..adc5986
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/template5.C
@@ -0,0 +1,19 @@
+// { dg-do compile }
+
+// Copyright (C) 2003 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 28 Jan 2003 <nathan@codesourcery.com>
+
+// PR 3902. More type/decl confusion.
+
+template <class T>
+struct S
+{
+ S foo (T (T));
+ S foo (T(const T&));
+};
+
+int main ()
+{
+ S<int> (S<int>::*pf1)(int (int)) = &S<int>::foo;
+ S<int> (S<int>::*pf2)(int (const int&)) = &S<int>::foo;
+}