summaryrefslogtreecommitdiff
path: root/test/SemaCXX/cxx11-user-defined-literals.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2014-11-24 09:15:30 +0000
committerDimitry Andric <dim@FreeBSD.org>2014-11-24 09:15:30 +0000
commit9f4dbff6669c8037f3b036bcf580d14f1a4f12a5 (patch)
tree47df2c12b57214af6c31e47404b005675b8b7ffc /test/SemaCXX/cxx11-user-defined-literals.cpp
parentf73d5f23a889b93d89ddef61ac0995df40286bb8 (diff)
Notes
Diffstat (limited to 'test/SemaCXX/cxx11-user-defined-literals.cpp')
-rw-r--r--test/SemaCXX/cxx11-user-defined-literals.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx11-user-defined-literals.cpp b/test/SemaCXX/cxx11-user-defined-literals.cpp
index f8bbcd960fd3..cb7796418ee3 100644
--- a/test/SemaCXX/cxx11-user-defined-literals.cpp
+++ b/test/SemaCXX/cxx11-user-defined-literals.cpp
@@ -141,3 +141,27 @@ namespace PR14950 {
int operator"" _b(); // expected-error {{no function template matches function template specialization}}
int main() { return 0_b; } // expected-error {{no matching literal operator for call to 'operator "" _b'}}
}
+
+namespace bad_names {
+ template<char...> int operator""_x();
+
+ template<typename T> void f() {
+ class T:: // expected-error {{anonymous class}} expected-warning {{does not declare anything}}
+ operator // expected-error {{expected identifier}}
+ ""_q<'a'>;
+
+ T::template operator""_q<'a'>(); // expected-error {{non-namespace scope 'T::' cannot have a literal operator member}} expected-error +{{}}
+ T::template operator""_q<'a'>::X; // expected-error {{non-namespace scope 'T::' cannot have a literal operator member}} expected-error +{{}}
+ T::operator""_q<'a'>(); // expected-error {{non-namespace scope 'T::' cannot have a literal operator member}} expected-error +{{}}
+ typename T::template operator""_q<'a'> a; // expected-error {{non-namespace scope 'T::' cannot have a literal operator member}} expected-error +{{}}
+ typename T::operator""_q(""); // expected-error +{{}} expected-note {{to match}}
+ T::operator""_q(""); // expected-error {{non-namespace scope 'T::' cannot have a literal operator member}}
+
+ bad_names::operator""_x<'a', 'b', 'c'>();
+ };
+
+ struct S {};
+ void g() {
+ S::operator""_q(); // expected-error {{non-namespace scope 'S::' cannot have a literal operator member}}
+ }
+}