]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/12288 (unintelligible error message for constructor declaration with misspe...
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 20 May 2013 17:13:47 +0000 (17:13 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 20 May 2013 17:13:47 +0000 (17:13 +0000)
/cp
2013-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/12288
* parser.c (cp_parser_parameter_declaration): Check return value
of cp_parser_parse_and_diagnose_invalid_type_name.

/testsuite
2013-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/12288
* g++.dg/parse/error52.C: New.
* g++.dg/parse/error3.C: Adjust.
* g++.dg/parse/error36.C: Likewise.

From-SVN: r199115

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/error3.C
gcc/testsuite/g++.dg/parse/error36.C
gcc/testsuite/g++.dg/parse/error52.C [new file with mode: 0644]

index b08afd929f58606bafc56b3444bebb576eb51a82..d1e3bb65c36226855c085dbf69dbe0fbf843449d 100644 (file)
@@ -1,3 +1,9 @@
+2013-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/12288
+       * parser.c (cp_parser_parameter_declaration): Check return value
+       of cp_parser_parse_and_diagnose_invalid_type_name.
+
 2013-05-20  Jason Merrill  <jason@redhat.com>
 
        PR c++/57319
index 91e6615ae38769e2c3e78e4178a74c994d82a492..c3096d372abcf5a3d22cc4a345b22a208261da6f 100644 (file)
@@ -17844,8 +17844,9 @@ cp_parser_parameter_declaration (cp_parser *parser,
                                &declares_class_or_enum);
 
   /* Complain about missing 'typename' or other invalid type names.  */
-  if (!decl_specifiers.any_type_specifiers_p)
-    cp_parser_parse_and_diagnose_invalid_type_name (parser);
+  if (!decl_specifiers.any_type_specifiers_p
+      && cp_parser_parse_and_diagnose_invalid_type_name (parser))
+    decl_specifiers.type = error_mark_node;
 
   /* If an error occurred, there's no reason to attempt to parse the
      rest of the declaration.  */
index 85aac1e2a103f50fb479103f4bd6e0d7dff4e9c8..4e8e6e4282d500a7d629d6de4672c05fb8b9395f 100644 (file)
@@ -1,3 +1,10 @@
+2013-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/12288
+       * g++.dg/parse/error52.C: New.
+       * g++.dg/parse/error3.C: Adjust.
+       * g++.dg/parse/error36.C: Likewise.
+
 2013-05-20  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/56547
index 58739934156f20e65a94acbc30045886313a8032..938ab45b24c5469a837f46b786f6ebb65e46a3d2 100644 (file)
@@ -5,5 +5,4 @@ static void InstantiateConstraint(const float&, unsigned,
                                   void(*AddFunction)(const TYPE&,bool&,
                                                      char*, char*,
                                                      unsigned*));
-// { dg-error "64: ISO C\\+\\+ forbids declaration of 'parameter' with no type" "forbids" { target *-*-* }  { 5 } }
 // { dg-error "60: 'TYPE' does not name a type" "does not" { target *-*-* } { 5 } }
index a99ad299d39c35d68a5e3c34fbe4622fa8947879..92e27a928dfce41d3054fe9d87bb38f90f4bde3d 100644 (file)
@@ -26,7 +26,6 @@ template <class T> struct B
 // PR c++/40738
 template <class T>
 void g(const A<T>::type &t);   // { dg-error "typename" "typename" }
-// { dg-error "no type" "no type" { target *-*-* } 28 }
 
 // PR c++/18451
 template <class T> A<T>::B A<T>::b; // { dg-error "typename" }
diff --git a/gcc/testsuite/g++.dg/parse/error52.C b/gcc/testsuite/g++.dg/parse/error52.C
new file mode 100644 (file)
index 0000000..d1c6e4a
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/12288
+
+class X {};
+
+struct S {
+  explicit S (const X::T&) {}  // { dg-error "does not name a type" }
+};
+
+class Y {};
+
+typedef Y::T xt;               // { dg-error "does not name a type" }