From: Martin Liska Date: Tue, 28 Jan 2020 09:26:53 +0000 (+0100) Subject: Replace one error with inform. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d3c00969fe619ae116dfbc07e6b364558acb6e3f;p=gcc.git Replace one error with inform. PR c++/92440 * pt.c (redeclare_class_template): Use inform for the second location. PR c++/92440 * g++.dg/template/pr92440.C: New test. * g++.dg/cpp0x/vt-34314.C: Update error to note. * g++.dg/template/pr59930-2.C: Likewise. * g++.old-deja/g++.pt/redecl1.C: Likewise. --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 44f397539f3..f029c202a19 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2020-01-28 Martin Liska + + PR c++/92440 + * pt.c (redeclare_class_template): Use inform + for the second location. + 2020-01-27 Jason Merrill PR c++/90966 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 6e614d5a058..274fe84c18f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6149,7 +6149,7 @@ redeclare_class_template (tree type, tree parms, tree cons) != TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (parm))))) { error ("template parameter %q+#D", tmpl_parm); - error ("redeclared here as %q#D", parm); + inform (input_location, "redeclared here as %q#D", parm); return false; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6518f7f2307..255cd08df31 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2020-01-28 Martin Liska + + PR c++/92440 + * g++.dg/template/pr92440.C: New test. + * g++.dg/cpp0x/vt-34314.C: Update error to note. + * g++.dg/template/pr59930-2.C: Likewise. + * g++.old-deja/g++.pt/redecl1.C: Likewise. + 2020-01-28 Jakub Jelinek PR target/93418 diff --git a/gcc/testsuite/g++.dg/cpp0x/vt-34314.C b/gcc/testsuite/g++.dg/cpp0x/vt-34314.C index ee0ed01b8d3..b37cac53223 100644 --- a/gcc/testsuite/g++.dg/cpp0x/vt-34314.C +++ b/gcc/testsuite/g++.dg/cpp0x/vt-34314.C @@ -4,7 +4,7 @@ template // { dg-error "template parameter" } struct call; template -struct call // { dg-error "redeclared here" } +struct call // { dg-message "note: redeclared here" } { template struct result; @@ -21,7 +21,7 @@ template // { dg-error "template parameter" } struct call2; template -struct call2 // { dg-error "redeclared here" } +struct call2 // { dg-message "note: redeclared here" } { template struct result; @@ -37,7 +37,7 @@ template class... TT> // { dg-error "template p struct call3; template class TT> -struct call3 // { dg-error "redeclared here" } +struct call3 // { dg-message "note: redeclared here" } { template struct result; diff --git a/gcc/testsuite/g++.dg/template/pr59930-2.C b/gcc/testsuite/g++.dg/template/pr59930-2.C index a7e6ea4ea9a..65ec58e23f4 100644 --- a/gcc/testsuite/g++.dg/template/pr59930-2.C +++ b/gcc/testsuite/g++.dg/template/pr59930-2.C @@ -6,7 +6,7 @@ namespace N { // Injects N::N template < T > friend class N; // { dg-error "template parameter" "" { target *-*-* } .-1 } - // { dg-error "redeclared" "" { target *-*-* } .-2 } + // { dg-message "note: redeclared" "" { target *-*-* } .-2 } }; } diff --git a/gcc/testsuite/g++.dg/template/pr92440.C b/gcc/testsuite/g++.dg/template/pr92440.C new file mode 100644 index 00000000000..20db5f10586 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr92440.C @@ -0,0 +1,10 @@ +// PR c++/92440 +// { dg-do compile } + +template // { dg-error "template parameter" } +struct S { + template + friend struct S; // { dg-message "note: redeclared here as" } +}; + +S<0> s; diff --git a/gcc/testsuite/g++.dg/template/redecl2.C b/gcc/testsuite/g++.dg/template/redecl2.C index 4dd432e6fea..31334f4f334 100644 --- a/gcc/testsuite/g++.dg/template/redecl2.C +++ b/gcc/testsuite/g++.dg/template/redecl2.C @@ -6,4 +6,4 @@ // non-type template parameter. template struct X; // { dg-error "template parameter" } -template struct X; // { dg-error "redeclared here" } +template struct X; // { dg-message "note: redeclared here" } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/redecl1.C b/gcc/testsuite/g++.old-deja/g++.pt/redecl1.C index 4a580e17742..48517f5d1d3 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/redecl1.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/redecl1.C @@ -16,7 +16,7 @@ template // { dg-error "template parameter" } struct S3; template -struct S3; // { dg-error "redeclared here" } +struct S3; // { dg-message "note: redeclared here" } template