PR c++/27670
PR c++/27493
PR c++/27494
PR c++/27397
* parser.c (cp_parser_template_parameter_list): Add
invalid template parameters to the parameter list as
error_mark_node.
* g++.dg/template/operator9.C: New test.
* g++.dg/template/operator7.C: New test.
* g++.dg/template/operator8.C: New test.
* g++.dg/template/crash57.C: New test.
* g++.dg/template/typedef4.C: Adjust error markers.
* g++.dg/template/typedef5.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116661
138bc75d-0d04-0410-961f-
82ee72b054a4
+2006-09-02 Lee Millward <lee.millward@codesourcery.com>
+
+ PR c++/27670
+ PR c++/27493
+ PR c++/27494
+ PR c++/27397
+ * parser.c (cp_parser_template_parameter_list): Add
+ invalid template parameters to the parameter list as
+ error_mark_node.
+
2006-09-02 Jakub Jelinek <jakub@redhat.com>
PR c++/28878
parameter_list = process_template_parm (parameter_list,
parameter,
is_non_type);
+ else
+ {
+ tree err_parm = build_tree_list (parameter, parameter);
+ TREE_VALUE (err_parm) = error_mark_node;
+ parameter_list = chainon (parameter_list, err_parm);
+ }
+
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
/* If it's not a `,', we're done. */
+2006-09-02 Lee Millward <lee.millward@codesourcery.com>
+
+ PR c+/27670
+ * g++.dg/template/operator9.C: New test.
+
+ PR c++/27493
+ * g++.dg/template/operator7.C: New test.
+
+ PR c++/27494
+ * g++.dg/template/operator8.C: New test.
+
+ PR c++/27397
+ * g++.dg/template/crash57.C: New test.
+
+ * g++.dg/template/typedef4.C: Adjust error markers.
+ * g++.dg/template/typedef5.C: Likewise.
+
2006-09-02 Jakub Jelinek <jakub@redhat.com>
PR c++/28878
--- /dev/null
+//PR c++/27397
+
+template<int(> struct A; // { dg-error "token" }
+
+template<typename> struct B
+{
+ template<int(> struct C; // { dg-error "token" }
+};
+
+A<char> a; // { dg-error "type/value mismatch|constant|declaration" }
--- /dev/null
+//PR c++/27493
+
+template<operator T> void foo() // { dg-error "before|template" }
+{
+ struct A {};
+}
--- /dev/null
+//PR c++/27494
+
+struct A
+{
+ template<operator+> void foo() {} // { dg-error "identifier|non-function|template arguments" }
+};
+
+struct B
+{
+ template<operator> void foo() {} // { dg-error "identifier|non-function|'void'" }
+ template<int> void bar() {} // { dg-error "template arguments" }
+};
--- /dev/null
+//PR c++/27670
+
+template<operator+> void foo(); // { dg-error "before|non-function|template" }
+
+void bar()
+{
+ foo(); // { dg-error "no matching function" }
+}
+
// PR c++/27572
// { dg-do compile }
-template<typedef> void foo(); // { dg-error "no type|typedef declaration" }
+template<typedef> void foo(); // { dg-error "no type|typedef declaration|template" }
void bar()
{
// PR c++/27572
// { dg-do compile }
-template<typedef,int> struct A1; // { dg-error "no type|typedef declaration" }
-template<typedef x,int> struct A2; // { dg-error "no type|typedef declaration" }
-template<typedef x[],int> struct A3; // { dg-error "no type|typedef declaration" }
-template<typedef int x, int> struct A4; // { dg-error "typedef declaration" }
+template<typedef,int> struct A1; // { dg-error "no type|typedef declaration|default argument" }
+template<typedef x,int> struct A2; // { dg-error "no type|typedef declaration|default argument" }
+template<typedef x[],int> struct A3; // { dg-error "no type|typedef declaration|default argument" }
+template<typedef int x, int> struct A4; // { dg-error "typedef declaration|default argument" }