Commit eeb75383 by Nathan Sidwell Committed by Nathan Sidwell

decl.c (grokdeclarator): Diagnose undefined template contexts.

cp:
	* decl.c (grokdeclarator): Diagnose undefined template contexts.
testsuite:
	* g++.old-deja/g++.pt/incomplete1.C: New test.

From-SVN: r37815
parent 5ee4cc26
2000-11-28 Nathan Sidwell <nathan@codesourcery.com> 2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (grokdeclarator): Diagnose undefined template contexts.
2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (grokdeclarator): Do type access control on friend * decl.c (grokdeclarator): Do type access control on friend
class. class.
......
...@@ -10995,8 +10995,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -10995,8 +10995,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
} }
else if (TREE_CODE (type) == FUNCTION_TYPE) else if (TREE_CODE (type) == FUNCTION_TYPE)
{ {
if (current_class_type == NULL_TREE if (current_class_type == NULL_TREE || friendp)
|| friendp)
type = build_cplus_method_type (ctype, TREE_TYPE (type), type = build_cplus_method_type (ctype, TREE_TYPE (type),
TYPE_ARG_TYPES (type)); TYPE_ARG_TYPES (type));
else else
...@@ -11022,18 +11021,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -11022,18 +11021,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
} }
type = build_offset_type (ctype, type); type = build_offset_type (ctype, type);
} }
else if (uses_template_parms (ctype))
{
if (TREE_CODE (type) == FUNCTION_TYPE)
type
= build_cplus_method_type (ctype, TREE_TYPE (type),
TYPE_ARG_TYPES (type));
}
else else
{ {
cp_error ("structure `%T' not yet defined", ctype); incomplete_type_error (NULL_TREE, ctype);
return error_mark_node; return error_mark_node;
} }
declarator = sname; declarator = sname;
} }
......
2000-11-28 Nathan Sidwell <nathan@codesourcery.com> 2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.pt/incomplete1.C: New test.
2000-11-28 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.other/friend9.C: New test. * g++.old-deja/g++.other/friend9.C: New test.
2000-11-28 Jakub Jelinek <jakub@redhat.com> 2000-11-28 Jakub Jelinek <jakub@redhat.com>
......
// Build don't link:
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 28 Nov 2000 <nathan@codesourcery.com>
// Inspired by by 756. We'd ICE when trying to define a member of an
// incomplete template type.
template<class X> struct ObjCount; // ERROR - forward decl
template<class X> int ObjCount<X>::m; // ERROR - undefined type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment