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.
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.
--- /dev/null
+// 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" }