Richard Smith | f4198b7 | 2013-07-23 08:14:48 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++1y %s -include %s -verify |
| 2 | |
| 3 | #ifndef INCLUDED |
| 4 | #define INCLUDED |
| 5 | |
| 6 | #pragma clang system_header |
| 7 | namespace std { |
| 8 | using size_t = decltype(sizeof(0)); |
| 9 | |
| 10 | struct duration {}; |
Richard Smith | 2a98862 | 2013-09-24 04:06:10 +0000 | [diff] [blame] | 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); |
Richard Smith | f4198b7 | 2013-07-23 08:14:48 +0000 | [diff] [blame] | 17 | |
| 18 | struct string {}; |
Richard Smith | 2a98862 | 2013-09-24 04:06:10 +0000 | [diff] [blame] | 19 | string operator""s(const char*, size_t); |
| 20 | |
| 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); |
Richard Smith | f4198b7 | 2013-07-23 08:14:48 +0000 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | #else |
| 31 | |
| 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 ';'}} |
| 36 | |
| 37 | int _1z = 1z; // expected-error {{invalid suffix}} |
| 38 | int _1b = 1b; // expected-error {{invalid digit}} |
| 39 | |
Richard Smith | 2a98862 | 2013-09-24 04:06:10 +0000 | [diff] [blame] | 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; |
| 43 | |
Richard Smith | f4198b7 | 2013-07-23 08:14:48 +0000 | [diff] [blame] | 44 | #endif |