TemplateParameterList *Params = FD->getTemplateParameters();
if (Params->size() == 1) {
IsTemplate = true;
+ if (!Params->getParam(0)->isTemplateParameterPack() && !StringLit) {
+ // Implied but not stated: user-defined integer and floating literals
+ // only ever use numeric literal operator templates, not templates
+ // taking a parameter of class type.
+ F.erase();
+ continue;
+ }
// A string literal template is only considered if the string literal
// is a well-formed template argument for the template parameter.
// expected-note@9{{candidate constructor (the implicit move constructor)}}
chrono::day hex_d = 0x44d;
chrono::year y = 10y;
+
+namespace ignore_class_udl_for_numeric_literals {
+ struct A { constexpr A(const char*) {} };
+ struct B { constexpr B(char); };
+ struct C { constexpr C(int); };
+ template<A> void operator""_a();
+ template<B> void operator""_b();
+ template<C> void operator""_c();
+ void test_class_udl_1() {
+ 1_a; // expected-error {{no matching}}
+ 1_b; // expected-error {{no matching}}
+ 1_c; // expected-error {{no matching}}
+ "1"_a;
+ "1"_b; // expected-error {{no matching}}
+ "1"_c; // expected-error {{no matching}}
+ }
+ template<char...> void operator""_a();
+ template<char...> void operator""_b();
+ template<char...> void operator""_c();
+ void test_class_udl_2() {
+ 1_a;
+ // FIXME: The standard appears to say these two are ambiguous!
+ 1_b;
+ 1_c;
+ "1"_a;
+ "1"_b; // expected-error {{no matching}}
+ "1"_c; // expected-error {{no matching}}
+ }
+}
#endif