* pt.c (invalid_nontype_parm_type_p): Avoid printing "<type error>".

From-SVN: r181220
This commit is contained in:
Jason Merrill 2011-11-09 12:53:24 -05:00 committed by Jason Merrill
parent ecf658592b
commit bc3e284b71
6 changed files with 19 additions and 5 deletions

View File

@ -1,5 +1,7 @@
2011-11-09 Jason Merrill <jason@redhat.com>
* pt.c (invalid_nontype_parm_type_p): Avoid printing "<type error>".
* pt.c (convert_nontype_argument): Only integral arguments
get early folding.

View File

@ -18976,7 +18976,13 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain)
return 0;
if (complain & tf_error)
error ("%q#T is not a valid type for a template constant parameter", type);
{
if (type == error_mark_node)
inform (input_location, "invalid template non-type parameter");
else
error ("%q#T is not a valid type for a template non-type parameter",
type);
}
return 1;
}

View File

@ -1,3 +1,9 @@
2011-11-09 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/variadic74.C: Adjust diags.
* g++.dg/template/crash53.C: Likewise.
* g++.dg/template/void9.C: Likewise.
2011-11-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51045

View File

@ -1,8 +1,8 @@
// { dg-options "-std=gnu++0x" }
// { dg-do compile { target c++11 } }
template <class... Types> class A
{
public:
template <Types... Values> class X { /* ... */ }; // { dg-error "not a valid type for a template constant parameter" }
template <Types... Values> class X { /* ... */ }; // { dg-error "not a valid type for a template non-type parameter" }
};
template<class... Types> class B

View File

@ -5,7 +5,7 @@ template<int> struct A {};
template<typename T> struct B
{
template<T I> B(A<I>); // { dg-error "template constant parameter" }
template<T I> B(A<I>); // { dg-error "template non-type parameter" }
};
B<double> a=A<0>(); // { dg-error "non-scalar type" }

View File

@ -1,4 +1,4 @@
//PR c++/28738
template<int,void> struct A {}; // { dg-error "not a valid type" }
template<int N> struct A<N,0> {}; // { dg-error "not a valid type" }
template<int N> struct A<N,0> {}; // { dg-message "invalid" }