2007-08-14 Paolo Carlini <pcarlini@suse.de>
PR c++/27211
* decl2.c (check_classfn): Return error_mark_node in case of error;
in that case, do not call add_method.
* decl.c (start_decl): Deal with check_classfn returning
error_mark_node.
(grokfndecl): Likewise.
* pt.c (tsubst_friend_function): Likewise.
/testsuite
2007-08-14 Paolo Carlini <pcarlini@suse.de>
PR c++/27211
* g++.dg/template/error27.C: New.
* g++.dg/template/error28.C: New.
* g++.dg/other/pr28304.C: Adjust.
* g++.old-deja/g++.mike/p811.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127492
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-08-14 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/27211
+ * decl2.c (check_classfn): Return error_mark_node in case of error;
+ in that case, do not call add_method.
+ * decl.c (start_decl): Deal with check_classfn returning
+ error_mark_node.
+ (grokfndecl): Likewise.
+ * pt.c (tsubst_friend_function): Likewise.
+
2007-08-14 Andrew Pinski <pinskia@gmail.com>
PR c++/30428
> template_class_depth (context))
? current_template_parms
: NULL_TREE);
- if (field && duplicate_decls (decl, field,
- /*newdecl_is_friend=*/false))
+ if (field && field != error_mark_node
+ && duplicate_decls (decl, field,
+ /*newdecl_is_friend=*/false))
decl = field;
}
&& (! TYPE_FOR_JAVA (ctype) || check_java_method (decl))
&& check)
{
- tree old_decl;
+ tree old_decl = check_classfn (ctype, decl,
+ (processing_template_decl
+ > template_class_depth (ctype))
+ ? current_template_parms
+ : NULL_TREE);
+
+ if (old_decl == error_mark_node)
+ return NULL_TREE;
- old_decl = check_classfn (ctype, decl,
- (processing_template_decl
- > template_class_depth (ctype))
- ? current_template_parms
- : NULL_TREE);
if (old_decl)
{
tree ok;
TEMPLATE_DECL, it can be NULL since the parameters can be extracted
from the declaration. If the function is not a function template, it
must be NULL.
- It returns the original declaration for the function, or NULL_TREE
- if no declaration was found (and an error was emitted). */
+ It returns the original declaration for the function, NULL_TREE if
+ no declaration was found, error_mark_node if an error was emitted. */
tree
check_classfn (tree ctype, tree function, tree template_parms)
error ("no %q#D member function declared in class %qT",
function, ctype);
- /* If we did not find the method in the class, add it to avoid
- spurious errors (unless the CTYPE is not yet defined, in which
- case we'll only confuse ourselves when the function is declared
- properly within the class. */
- if (COMPLETE_TYPE_P (ctype))
- add_method (ctype, function, NULL_TREE);
-
if (pushed_scope)
pop_scope (pushed_scope);
- return NULL_TREE;
+ return error_mark_node;
}
/* DECL is a function with vague linkage. Remember it so that at the
+2007-08-14 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/27211
+ * g++.dg/template/error27.C: New.
+ * g++.dg/template/error28.C: New.
+ * g++.dg/other/pr28304.C: Adjust.
+ * g++.old-deja/g++.mike/p811.C: Likewise.
+
2007-08-14 Rask Ingemann Lambertsen <rask@sygehus.dk>
PR target/30315
void bar()
{
- A::foo(1); // { dg-error "no matching function for call" }
+ A::foo(1); // { dg-error "not a member" }
}
--- /dev/null
+// PR c++/27211
+
+struct A {};
+
+template<int> void A::foo() {} // { dg-error "member function" }
--- /dev/null
+// PR c++/27211
+
+struct A {};
+
+template<int> void A::foo(); // { dg-error "member function" }
char *
X::stringify() const // { dg-error "does not match" }
{
- return "stringify"; // { dg-warning "deprecated" }
+ return "stringify";
}
const char *