From: Jason Merrill Date: Wed, 9 Nov 2011 17:53:24 +0000 (-0500) Subject: * pt.c (invalid_nontype_parm_type_p): Avoid printing "". X-Git-Tag: releases/gcc-4.7.0~2302 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc3e284b718091979f7c9d21aad2033855caeb41;p=thirdparty%2Fgcc.git * pt.c (invalid_nontype_parm_type_p): Avoid printing "". From-SVN: r181220 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 095f671f51e9..03ffecec7bff 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,7 @@ 2011-11-09 Jason Merrill + * pt.c (invalid_nontype_parm_type_p): Avoid printing "". + * pt.c (convert_nontype_argument): Only integral arguments get early folding. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a804fda494ac..71a98b0de19f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 691711d27747..ef4b175d4d74 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-11-09 Jason Merrill + + * g++.dg/cpp0x/variadic74.C: Adjust diags. + * g++.dg/template/crash53.C: Likewise. + * g++.dg/template/void9.C: Likewise. + 2011-11-09 Paolo Carlini PR c++/51045 diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic74.C b/gcc/testsuite/g++.dg/cpp0x/variadic74.C index 19b6b11d8e2f..5b502b974ccb 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic74.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic74.C @@ -1,8 +1,8 @@ -// { dg-options "-std=gnu++0x" } +// { dg-do compile { target c++11 } } template class A { public: - template class X { /* ... */ }; // { dg-error "not a valid type for a template constant parameter" } + template class X { /* ... */ }; // { dg-error "not a valid type for a template non-type parameter" } }; template class B diff --git a/gcc/testsuite/g++.dg/template/crash53.C b/gcc/testsuite/g++.dg/template/crash53.C index bbd1e7fc7aeb..a8d7c1110bfa 100644 --- a/gcc/testsuite/g++.dg/template/crash53.C +++ b/gcc/testsuite/g++.dg/template/crash53.C @@ -5,7 +5,7 @@ template struct A {}; template struct B { - template B(A); // { dg-error "template constant parameter" } + template B(A); // { dg-error "template non-type parameter" } }; B a=A<0>(); // { dg-error "non-scalar type" } diff --git a/gcc/testsuite/g++.dg/template/void9.C b/gcc/testsuite/g++.dg/template/void9.C index bb2ed66ff381..319a684fa435 100644 --- a/gcc/testsuite/g++.dg/template/void9.C +++ b/gcc/testsuite/g++.dg/template/void9.C @@ -1,4 +1,4 @@ //PR c++/28738 template struct A {}; // { dg-error "not a valid type" } -template struct A {}; // { dg-error "not a valid type" } +template struct A {}; // { dg-message "invalid" }