diff options
author | Jason Merrill <jason@redhat.com> | 2011-11-09 12:53:24 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-11-09 12:53:24 -0500 |
commit | bc3e284b718091979f7c9d21aad2033855caeb41 (patch) | |
tree | 0825fc6c3dbe77f71df1d622946be2e8079c0d7d | |
parent | ecf658592bd49b71fd6579f3da8122df9e27504f (diff) | |
download | gcc-bc3e284b718091979f7c9d21aad2033855caeb41.zip gcc-bc3e284b718091979f7c9d21aad2033855caeb41.tar.gz gcc-bc3e284b718091979f7c9d21aad2033855caeb41.tar.bz2 |
* pt.c (invalid_nontype_parm_type_p): Avoid printing "<type error>".
From-SVN: r181220
-rw-r--r-- | gcc/cp/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/cp/pt.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/variadic74.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/crash53.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/void9.C | 2 |
6 files changed, 19 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 095f671..03ffece 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a804fda..71a98b0 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 691711d..ef4b175 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic74.C b/gcc/testsuite/g++.dg/cpp0x/variadic74.C index 19b6b11..5b502b9 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... 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 diff --git a/gcc/testsuite/g++.dg/template/crash53.C b/gcc/testsuite/g++.dg/template/crash53.C index bbd1e7f..a8d7c11 100644 --- a/gcc/testsuite/g++.dg/template/crash53.C +++ b/gcc/testsuite/g++.dg/template/crash53.C @@ -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" } diff --git a/gcc/testsuite/g++.dg/template/void9.C b/gcc/testsuite/g++.dg/template/void9.C index bb2ed66..319a684 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<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" } |