Commit ba7d31f6 by Jason Merrill Committed by Jason Merrill

re PR c++/47125 (ICE occurs in combination with partial specialization and…

re PR c++/47125 (ICE occurs in combination with partial specialization and invalid template function.)

	PR c++/47125
	* pt.c (tsubst) [TYPENAME_TYPE]: Only give errors if tf_error.

From-SVN: r170896
parent 8e71a206
2011-03-11 Jason Merrill <jason@redhat.com>
PR c++/47125
* pt.c (tsubst) [TYPENAME_TYPE]: Only give errors if tf_error.
PR c++/47144
* parser.c (cp_parser_template_type_arg): Set
type_definition_forbidden_message.
......
......@@ -10948,11 +10948,21 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (TREE_CODE (f) != TYPENAME_TYPE)
{
if (TYPENAME_IS_ENUM_P (t) && TREE_CODE (f) != ENUMERAL_TYPE)
error ("%qT resolves to %qT, which is not an enumeration type",
t, f);
{
if (complain & tf_error)
error ("%qT resolves to %qT, which is not an enumeration type",
t, f);
else
return error_mark_node;
}
else if (TYPENAME_IS_CLASS_P (t) && !CLASS_TYPE_P (f))
error ("%qT resolves to %qT, which is is not a class type",
t, f);
{
if (complain & tf_error)
error ("%qT resolves to %qT, which is is not a class type",
t, f);
else
return error_mark_node;
}
}
return cp_build_qualified_type_real
......
2011-03-11 Jason Merrill <jason@redhat.com>
* g++.dg/template/error45.C: New.
* g++.dg/parse/no-type-defn1.C: New.
* g++.dg/ext/attrib40.C: New.
......
// PR c++/47125
template < bool, typename >
struct enable_if {};
template < typename T >
struct enable_if< true, T >
{
typedef T type;
};
template < typename T >
struct enable_if< true, T >::type
f( T x );
void
g( void )
{
f< int >( 0 ); // { dg-error "no match" }
}
// { dg-prune-output "note" }
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