The patch kit changes the output of this case:

  1  //PR c++/27668
  2
  3  template<typename class T, T = T()> // { dg-error 
"nested-name-specifier|two or more|valid type" }
  4  struct A {};
  5
  6  template<int> void foo(A<int>);  // { dg-error "cast|argument" "" { target 
c++98_only } }

but only for c++98, from:
  g++.dg/template/crash55.C:3:19: error: expected nested-name-specifier before 
'class'
  g++.dg/template/crash55.C:3:25: error: two or more data types in declaration 
of 'parameter'
  g++.dg/template/crash55.C:3:34: error: 'class T' is not a valid type for a 
template non-type parameter
  g++.dg/template/crash55.C:6:29: error: a cast to a type other than an 
integral or enumeration type cannot appear in a constant-expression
  g++.dg/template/crash55.C:6:29: error: template argument 2 is invalid
to:
  g++.dg/template/crash55.C:3:19: error: expected nested-name-specifier before 
'class'
  g++.dg/template/crash55.C:3:25: error: two or more data types in declaration 
of 'parameter'
  g++.dg/template/crash55.C:3:34: error: 'class T' is not a valid type for a 
template non-type parameter
  g++.dg/template/crash55.C:3:32: error: a cast to a type other than an 
integral or enumeration type cannot appear in a constant-expression
  g++.dg/template/crash55.C:6:29: error: template argument 2 is invalid

i.e. the 4th error moves from line 6 to line 3
("a cast to a type other than an integral or enumeration type cannot appear in 
a constant-expression")

This change is reasonable, so the patch updates the dg-error
directives accordingly.

gcc/testsuite/ChangeLog:
        * g++.dg/template/crash55.C: Update dg-error directives.
---
 gcc/testsuite/g++.dg/template/crash55.C | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/g++.dg/template/crash55.C 
b/gcc/testsuite/g++.dg/template/crash55.C
index 9b80fd1..b9b29f7 100644
--- a/gcc/testsuite/g++.dg/template/crash55.C
+++ b/gcc/testsuite/g++.dg/template/crash55.C
@@ -1,6 +1,7 @@
 //PR c++/27668
 
 template<typename class T, T = T()> // { dg-error "nested-name-specifier|two 
or more|valid type" }
+// { dg-error "cast" "" { target c++98_only } 3 }
 struct A {};
 
-template<int> void foo(A<int>);        // { dg-error "cast|argument" "" { 
target c++98_only } }
+template<int> void foo(A<int>);        // { dg-error "template argument 2" "" 
{ target c++98_only } }
-- 
1.8.5.3

Reply via email to