We do parse hexfloats in C++11; make it actually work.

llvm-svn: 141798
This commit is contained in:
Douglas Gregor 2011-10-12 18:51:02 +00:00
parent 1a2c5386cd
commit 227c352bae
3 changed files with 3 additions and 12 deletions

View File

@ -1358,8 +1358,7 @@ void Lexer::LexNumericConstant(Token &Result, const char *CurPtr) {
}
// If we have a hex FP constant, continue.
if ((C == '-' || C == '+') && (PrevCh == 'P' || PrevCh == 'p') &&
!Features.CPlusPlus0x)
if ((C == '-' || C == '+') && (PrevCh == 'P' || PrevCh == 'p'))
return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result));
// Update the location of token as well as BufferPtr.

View File

@ -562,9 +562,6 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) {
}
s = first_non_digit;
// In C++0x, we cannot support hexadecmial floating literals because
// they conflict with user-defined literals, so we warn in previous
// versions of C++ by default.
if (!PP.getLangOptions().HexFloats)
PP.Diag(TokLoc, diag::ext_hexconstant_invalid);
} else if (saw_period) {

View File

@ -1,9 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
// XFAIL: *
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s
float f = 0x1p+1; // expected-warning{{hexadecimal floating constants are a C99 feature}}
#ifndef __GXX_EXPERIMENTAL_CXX0X__
float f = 0x1p+1; // expected-warning {{incompatible with C++0x}}
#else
float f = 0x1p+1; // expected-warning {{invalid suffix}}
#endif