parser.c (cp_parser_template_declaration_after_parameters): Use DECL_SOURCE_LOCATION...
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 21 May 2019 23:11:26 +0000 (23:11 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 21 May 2019 23:11:26 +0000 (23:11 +0000)
/cp
2019-05-21  Paolo Carlini  <paolo.carlini@oracle.com>

* parser.c (cp_parser_template_declaration_after_parameters): Use
DECL_SOURCE_LOCATION in literal operator template errors.

/testsuite
2019-05-21  Paolo Carlini  <paolo.carlini@oracle.com>

* g++.dg/cpp0x/udlit-tmpl-arg-neg2.C: Check locations too.
* g++.dg/cpp0x/udlit-tmpl-parms-neg.C: Likewise.

From-SVN: r271492

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp0x/decltype-pr66548.C
gcc/testsuite/g++.dg/cpp0x/udlit-tmpl-arg-neg2.C
gcc/testsuite/g++.dg/cpp0x/udlit-tmpl-parms-neg.C

index e26cb9856ff3e7a2affb54a97ff9d28491fc810c..970f7e89b380640c18b57dc07538eae4730d60ec 100644 (file)
@@ -1,3 +1,8 @@
+2019-05-21  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * parser.c (cp_parser_template_declaration_after_parameters): Use
+       DECL_SOURCE_LOCATION in literal operator template errors.
+
 2019-05-21  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/67184
index 290f897ec140e79173511c218252e8333e63c7ed..1440fdb0d184a2c63e283faedb9ea327adb7c23d 100644 (file)
@@ -27895,14 +27895,16 @@ cp_parser_template_declaration_after_parameters (cp_parser* parser,
       if (!ok)
        {
          if (cxx_dialect > cxx17)
-           error ("literal operator template %qD has invalid parameter list;"
-                  " expected non-type template parameter pack %<<char...>%> "
-                  "or single non-type parameter of class type",
-                  decl);
+           error_at (DECL_SOURCE_LOCATION (decl), "literal operator "
+                     "template %qD has invalid parameter list; expected "
+                     "non-type template parameter pack %<<char...>%> or "
+                     "single non-type parameter of class type",
+                     decl);
          else
-           error ("literal operator template %qD has invalid parameter list;"
-                  " expected non-type template parameter pack %<<char...>%>",
-                  decl);
+           error_at (DECL_SOURCE_LOCATION (decl), "literal operator "
+                     "template %qD has invalid parameter list; expected "
+                     "non-type template parameter pack %<<char...>%>",
+                     decl);
        }
     }
 
index f4b7caa9eae63631d2a4d9aba57a768f92c7fb5f..3f20d152affde06d645f06c01ffadb8d247c7ffc 100644 (file)
@@ -11,7 +11,7 @@ struct Meow {};
 
 void f ()
 {
-  decltype (Meow.purr ()) d;   // { dg-error "expected primary-expression" "pr89875" { xfail c++98_only } }
+  decltype (Meow.purr ()) d;   // { dg-error "expected primary-expression" }
   (void)&d;
 }
 
index c426e0e4d85ec77521d2529dc8c584b463156dbd..f2db95d3eaddc812fd25e77c4a38175e1983019c 100644 (file)
@@ -2,6 +2,6 @@
 // { dg-do compile { target c++11 } }
 
 template <T, T... U>           // { dg-error "'T' has not been declared" }
-int operator"" _foo ();                // { dg-error "has invalid parameter list" }
+int operator"" _foo ();                // { dg-error "5:literal operator template .int operator\"\"_foo\\(\\). has invalid parameter list" }
 template <T... U>              // { dg-error "'T' has not been declared" }
-int operator"" _bar ();                // { dg-error "has invalid parameter list" }
+int operator"" _bar ();                // { dg-error "5:literal operator template .int operator\"\"_bar\\(\\). has invalid parameter list" }
index f681ecfbcc1f62772a239327d31dfc4567517155..167d871a0055fadb41fa6775daae366dd3d4c7a4 100644 (file)
@@ -3,10 +3,10 @@
 class Foo { };
 
 template<wchar_t...>
-  Foo operator"" _Foo(); // { dg-error "literal operator template|has invalid parameter list" }
+  Foo operator"" _Foo(); // { dg-error "7:literal operator template .Foo operator\"\"_Foo\\(\\). has invalid parameter list" }
 
 template<char>
-  Foo operator"" _Bar(); // { dg-error "literal operator template|has invalid parameter list" }
+  Foo operator"" _Bar(); // { dg-error "7:literal operator template .Foo operator\"\"_Bar\\(\\). has invalid parameter list" }
 
 template<typename... Type>
-  Foo operator"" _Bar(); // { dg-error "literal operator template|has invalid parameter list" }
+  Foo operator"" _Bar(); // { dg-error "7:literal operator template .Foo operator\"\"_Bar\\(\\). has invalid parameter list" }