+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
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);
}
}
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;
}
// { 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" }
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" }