1 | // RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify -pedantic %s |
2 | // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s |
3 | // RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -pedantic %s |
4 | // RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify -pedantic %s |
5 | double e = 0x.p0; // expected-error-re {{hexadecimal floating {{constant|literal}} requires a significand}} |
6 | |
7 | float f = 0x1p+1; |
8 | double d = 0x.2p2; |
9 | float g = 0x1.2p2; |
10 | double h = 0x1.p2; |
11 | #if __cplusplus <= 201402L |
12 | // expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} |
13 | // expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} |
14 | // expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} |
15 | // expected-warning@-5 {{hexadecimal floating literals are a C++17 feature}} |
16 | #endif |
17 | |
18 | // PR12717: In order to minimally diverge from the C++ standard, we do not lex |
19 | // 'p[+-]' as part of a pp-number unless the token starts 0x and doesn't contain |
20 | // an underscore. |
21 | double i = 0p+3; // expected-error {{invalid suffix 'p' on integer constant}} |
22 | #define PREFIX(x) foo ## x |
23 | double foo0p = 1, j = PREFIX(0p+3); // ok |
24 | double k = 0x42_amp+3; |
25 | #if __cplusplus > 201402L |
26 | // expected-error@-2 {{no matching literal operator for call to 'operator""_amp+3'}} |
27 | #elif __cplusplus >= 201103L |
28 | // expected-error@-4 {{no matching literal operator for call to 'operator""_amp'}} |
29 | #else |
30 | // expected-error@-6 {{invalid suffix '_amp' on integer constant}} |
31 | #endif |
32 | |