[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaCXX / cxx1y-user-defined-literals.cpp
blobd79924c8e2ed1020d21fddb8932ed2c1a30e1f5e
1 // RUN: %clang_cc1 -std=c++1y %s -include %s -verify
3 #ifndef INCLUDED
4 #define INCLUDED
6 #pragma clang system_header
7 namespace std {
8 using size_t = decltype(sizeof(0));
10 struct duration {};
11 duration operator""ns(unsigned long long);
12 duration operator""us(unsigned long long);
13 duration operator""ms(unsigned long long);
14 duration operator""s(unsigned long long);
15 duration operator""min(unsigned long long);
16 duration operator""h(unsigned long long);
18 struct string {};
19 string operator""s(const char*, size_t);
21 template<typename T> struct complex {};
22 complex<float> operator""if(long double);
23 complex<float> operator""if(unsigned long long);
24 complex<double> operator""i(long double);
25 complex<double> operator""i(unsigned long long);
26 complex<long double> operator""il(long double);
27 complex<long double> operator""il(unsigned long long);
30 #else
32 using namespace std;
33 duration a = 1ns, b = 1us, c = 1ms, d = 1s, e = 1min, f = 1h;
34 string s = "foo"s;
35 char error = 'x's; // expected-error {{invalid suffix}} expected-error {{expected ';'}}
37 int _1y = 1y; // expected-error {{invalid suffix}}
38 int _1b = 1b; // expected-error {{invalid digit}}
40 complex<float> cf1 = 1if, cf2 = 2.if, cf3 = 0x3if;
41 complex<double> cd1 = 1i, cd2 = 2.i, cd3 = 0b0110101i;
42 complex<long double> cld1 = 1il, cld2 = 2.il, cld3 = 0047il;
44 #endif