+2004-11-16 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ * decl.c (start_preparsed_function): Call check_function_type even
+ in templates.
+ (require_complete_types_for_parms): Skip dependent types.
+ (check_function_type): Likewise.
+
2004-11-16 Steven Bosscher <stevenb@suse.de>
* Make-lang.in (cp/decl.o, cp/search.o): Don't depend on stack.h.
{
for (; parms; parms = TREE_CHAIN (parms))
{
+ if (dependent_type_p (TREE_TYPE (parms)))
+ continue;
if (VOID_TYPE_P (TREE_TYPE (parms)))
/* grokparms will have already issued an error. */
TREE_TYPE (parms) = error_mark_node;
/* In a function definition, arg types must be complete. */
require_complete_types_for_parms (current_function_parms);
+ if (dependent_type_p (return_type))
+ return;
if (!COMPLETE_OR_VOID_TYPE_P (return_type))
{
error ("return type %q#T is incomplete", TREE_TYPE (fntype));
/* Make sure the parameter and return types are reasonable. When
you declare a function, these types can be incomplete, but they
must be complete when you define the function. */
- if (! processing_template_decl)
- check_function_type (decl1, current_function_parms);
+ check_function_type (decl1, current_function_parms);
/* Build the return declaration for the function. */
restype = TREE_TYPE (fntype);
+2004-11-16 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ * g++.dg/template/incomplete1.C: New test.
+
2004-11-16 Nick Clifton <nickc@redhat.com>
Revert patches accidentally commited during checkin of fixes for
--- /dev/null
+// { dg-do compile }
+// Origin: Ivan Godard <igodard at pacbell dot net>
+// PR c++/17447: Detect parameters of dependent types even in templates
+
+struct B; // { dg-error "forward declaration" }
+template<typename T> struct A {
+
+ friend A& operator <<(A& a, B b) { return a; } // { dg-error "incomplete" }
+ friend A& operator <<(A& a, T b) { return a; }
+
+ void foo1(B b) {} // { dg-error "incomplete" }
+ void foo1a(T b) {}
+
+ B foo2(void) {} // { dg-error "incomplete" }
+ T foo2a(void) {}
+
+ void foo3(B b);
+};