Commit 4230cec2 by Nathan Sidwell Committed by Nathan Sidwell

re PR c++/19884 (ICE on explicit instantiation of a non-template constructor)

cp:
	PR c++/19884
	* pt.c (check_explicit_specialization): Make sure namespace
	binding lookup found an overloaded function.
	(lookup_template_function): Just assert FNS is an overloaded
	function.

	PR c++/19895
	* decl.c (grokdeclarator): Check for error mark node in ptrmem
	construction.
testsuite:
	PR c++/19895
	* g++.dg/parse/ptrmem3.C: New.

	PR c++/19884
	* g++.old-deja/g++.oliva/template6.C: Add another case.
	* g++.dg/template/explicit6.C: New.

From-SVN: r95009
parent d1fc3bbd
2005-02-14 Nathan Sidwell <nathan@codesourcery.com>
PR c++/19884
* pt.c (check_explicit_specialization): Make sure namespace
binding lookup found an overloaded function.
(lookup_template_function): Just assert FNS is an overloaded
function.
PR c++/19895
* decl.c (grokdeclarator): Check for error mark node in ptrmem
construction.
2005-02-14 Alexandre Oliva <aoliva@redhat.com> 2005-02-14 Alexandre Oliva <aoliva@redhat.com>
PR c++/17816 PR c++/17816
* decl.c (redeclaration_error_message): Report redefinition of * decl.c (redeclaration_error_message): Report redefinition of
pure virtual function. pure virtual function.
2005-02-11 Nathan Sidwell <nathan@codesourcery.com> 2005-02-14 Nathan Sidwell <nathan@codesourcery.com>
PR c++/19891 PR c++/19891
* class.c (build_simple_base_path): Build the component_ref * class.c (build_simple_base_path): Build the component_ref
......
...@@ -7348,6 +7348,9 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7348,6 +7348,9 @@ grokdeclarator (const cp_declarator *declarator,
declarator->u.pointer.class_type); declarator->u.pointer.class_type);
type = build_pointer_type (type); type = build_pointer_type (type);
} }
else if (declarator->u.pointer.class_type == error_mark_node)
/* We will already have complained. */
type = error_mark_node;
else else
type = build_ptrmem_type (declarator->u.pointer.class_type, type = build_ptrmem_type (declarator->u.pointer.class_type,
type); type);
......
...@@ -1883,6 +1883,11 @@ check_explicit_specialization (tree declarator, ...@@ -1883,6 +1883,11 @@ check_explicit_specialization (tree declarator,
/* Find the namespace binding, using the declaration /* Find the namespace binding, using the declaration
context. */ context. */
fns = namespace_binding (dname, CP_DECL_CONTEXT (decl)); fns = namespace_binding (dname, CP_DECL_CONTEXT (decl));
if (!fns || !is_overloaded_fn (fns))
{
error ("%qD is not a template function", dname);
fns = error_mark_node;
}
} }
declarator = lookup_template_function (fns, NULL_TREE); declarator = lookup_template_function (fns, NULL_TREE);
...@@ -4196,17 +4201,8 @@ lookup_template_function (tree fns, tree arglist) ...@@ -4196,17 +4201,8 @@ lookup_template_function (tree fns, tree arglist)
return error_mark_node; return error_mark_node;
gcc_assert (!arglist || TREE_CODE (arglist) == TREE_VEC); gcc_assert (!arglist || TREE_CODE (arglist) == TREE_VEC);
if (fns == NULL_TREE gcc_assert (fns && (is_overloaded_fn (fns)
|| TREE_CODE (fns) == FUNCTION_DECL) || TREE_CODE (fns) == IDENTIFIER_NODE));
{
error ("non-template used as template");
return error_mark_node;
}
gcc_assert (TREE_CODE (fns) == TEMPLATE_DECL
|| TREE_CODE (fns) == OVERLOAD
|| BASELINK_P (fns)
|| TREE_CODE (fns) == IDENTIFIER_NODE);
if (BASELINK_P (fns)) if (BASELINK_P (fns))
{ {
......
2005-02-14 Nathan Sidwell <nathan@codesourcery.com>
PR c++/19895
* g++.dg/parse/ptrmem3.C: New.
PR c++/19884
* g++.old-deja/g++.oliva/template6.C: Add another case.
* g++.dg/template/explicit6.C: New.
2005-02-14 Alexandre Oliva <aoliva@redhat.com> 2005-02-14 Alexandre Oliva <aoliva@redhat.com>
PR c++/17816 PR c++/17816
......
// Copyright (C) 2005 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Feb 2005 <nathan@codesourcery.com>
// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
// Bug 19895: ICE on invalid
template<typename> struct A
{
int A<0>::* p; // { dg-error "(type/value mismatch)|(expected)" "" }
};
// Copyright (C) 2005 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Feb 2005 <nathan@codesourcery.com>
// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
// Bug 19895: ICE on invalid
struct A;
template A<>::A(); // { dg-error "(not a template)|(explicit qualification)" "" }
...@@ -6,4 +6,7 @@ ...@@ -6,4 +6,7 @@
// simplified from bug report by Meenaradchagan Vishnu <mvishnu@fore.com> // simplified from bug report by Meenaradchagan Vishnu <mvishnu@fore.com>
template <typename> struct foo {}; template <typename> struct foo {};
template <> void foo(); // { dg-error "" } bad specialization template <> void foo(); // { dg-error "not a template function" } bad specialization
struct baz {};
template <> void baz (); // { dg-error "not a template function" } bad specialization
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