diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-03-04 22:32:06 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-03-04 22:32:06 +0000 |
| commit | 560a3579b29a07c729d841acaa1d3371b5fc9b71 (patch) | |
| tree | 38d1d789e15125216b8b6d846818963a982d51d8 /clang/test/Lexer | |
| parent | ac92893a93618d66416afbdd86db1ce99543e3e4 (diff) | |
| download | bcm5719-llvm-560a3579b29a07c729d841acaa1d3371b5fc9b71.tar.gz bcm5719-llvm-560a3579b29a07c729d841acaa1d3371b5fc9b71.zip | |
Update diagnostics now that hexadecimal literals look likely to be part of C++17.
llvm-svn: 262753
Diffstat (limited to 'clang/test/Lexer')
| -rw-r--r-- | clang/test/Lexer/cxx1y_digit_separators.cpp | 2 | ||||
| -rw-r--r-- | clang/test/Lexer/hexfloat.cpp | 32 |
2 files changed, 25 insertions, 9 deletions
diff --git a/clang/test/Lexer/cxx1y_digit_separators.cpp b/clang/test/Lexer/cxx1y_digit_separators.cpp index c076e7de057..55366342eda 100644 --- a/clang/test/Lexer/cxx1y_digit_separators.cpp +++ b/clang/test/Lexer/cxx1y_digit_separators.cpp @@ -48,7 +48,7 @@ namespace floating { float r = 0.'0e1; // expected-error {{digit separator cannot appear at start of digit sequence}} float s = 0.0'e1; // expected-error {{digit separator cannot appear at end of digit sequence}} float t = 0.0e'1; // expected-error {{digit separator cannot appear at start of digit sequence}} - float u = 0x.'p1f; // expected-error {{hexadecimal floating constants require a significand}} + float u = 0x.'p1f; // expected-error {{hexadecimal floating literal requires a significand}} float v = 0e'f; // expected-error {{exponent has no digits}} float w = 0x0p'f; // expected-error {{exponent has no digits}} } diff --git a/clang/test/Lexer/hexfloat.cpp b/clang/test/Lexer/hexfloat.cpp index 6985c7fbe2a..163db72f56f 100644 --- a/clang/test/Lexer/hexfloat.cpp +++ b/clang/test/Lexer/hexfloat.cpp @@ -1,15 +1,31 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -verify -pedantic %s // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s -float f = 0x1p+1; // expected-warning{{hexadecimal floating constants are a C99 feature}} -double e = 0x.p0; //expected-error{{hexadecimal floating constants require a significand}} -double d = 0x.2p2; // expected-warning{{hexadecimal floating constants are a C99 feature}} -float g = 0x1.2p2; // expected-warning{{hexadecimal floating constants are a C99 feature}} -double h = 0x1.p2; // expected-warning{{hexadecimal floating constants are a C99 feature}} +// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify -pedantic %s +// RUN: %clang_cc1 -std=c++1z -fsyntax-only -verify -pedantic %s +double e = 0x.p0; // expected-error-re {{hexadecimal floating {{constant|literal}} requires a significand}} + +float f = 0x1p+1; +double d = 0x.2p2; +float g = 0x1.2p2; +double h = 0x1.p2; +#if __cplusplus <= 201402L +// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} +// expected-warning@-5 {{hexadecimal floating literals are a C++1z feature}} +#endif // PR12717: In order to minimally diverge from the C++ standard, we do not lex // 'p[+-]' as part of a pp-number unless the token starts 0x and doesn't contain // an underscore. -double i = 0p+3; // expected-error{{invalid suffix 'p' on integer constant}} +double i = 0p+3; // expected-error {{invalid suffix 'p' on integer constant}} #define PREFIX(x) foo ## x double foo0p = 1, j = PREFIX(0p+3); // ok -double k = 0x42_amp+3; // expected-error-re{{{{invalid suffix '_amp' on integer constant|no matching literal operator for call to 'operator""_amp'}}}} +double k = 0x42_amp+3; +#if __cplusplus > 201402L +// expected-error@-2 {{no matching literal operator for call to 'operator""_amp+3'}} +#elif __cplusplus >= 201103L +// expected-error@-4 {{no matching literal operator for call to 'operator""_amp'}} +#else +// expected-error@-6 {{invalid suffix '_amp' on integer constant}} +#endif |

