summaryrefslogtreecommitdiffstats
path: root/clang/test/Lexer
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Lexer')
-rw-r--r--clang/test/Lexer/cxx1y_digit_separators.cpp2
-rw-r--r--clang/test/Lexer/hexfloat.cpp32
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
OpenPOWER on IntegriCloud