r310426 - Revert "Lexer: always allow imaginary constants in GNU mode."

Tim Northover via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 8 16:17:51 PDT 2017


Author: tnorthover
Date: Tue Aug  8 16:17:51 2017
New Revision: 310426

URL: http://llvm.org/viewvc/llvm-project?rev=310426&view=rev
Log:
Revert "Lexer: always allow imaginary constants in GNU mode."

This reverts r310423. It was committed by mistake, I intended to commit the
improved diagnostics for implicit conversions instead.

Removed:
    cfe/trunk/test/Lexer/imaginary-constants.cpp
Modified:
    cfe/trunk/lib/Lex/LiteralSupport.cpp
    cfe/trunk/test/SemaCXX/constexpr-printing.cpp
    cfe/trunk/unittests/AST/DeclTest.cpp

Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=310426&r1=310425&r2=310426&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Tue Aug  8 16:17:51 2017
@@ -659,7 +659,7 @@ NumericLiteralParser::NumericLiteralPars
         }
       }
       // "i", "if", and "il" are user-defined suffixes in C++1y.
-      if (*s == 'i' && !PP.getLangOpts().GNUMode)
+      if (*s == 'i' && PP.getLangOpts().CPlusPlus14)
         break;
       // fall through.
     case 'j':

Removed: cfe/trunk/test/Lexer/imaginary-constants.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/imaginary-constants.cpp?rev=310425&view=auto
==============================================================================
--- cfe/trunk/test/Lexer/imaginary-constants.cpp (original)
+++ cfe/trunk/test/Lexer/imaginary-constants.cpp (removed)
@@ -1,25 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=gnu++98 -DHAVE_IMAGINARY=1
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=gnu++11 -DHAVE_IMAGINARY=1
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=gnu++14 -DHAVE_IMAGINARY=1
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -DHAVE_IMAGINARY=0
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 -DHAVE_IMAGINARY=0
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14 -DHAVE_IMAGINARY=0 -DCXX14=1
-
-// Imaginary constants are a GNU extension that became problematic when C++14
-// defined its own versions. Until then they're supported even in
-// standards-compliant mode.
-#if HAVE_IMAGINARY
-// expected-no-diagnostics
-#elif CXX14
-// expected-error at +9 {{no matching literal operator for call to 'operator""i' with argument of type 'unsigned long long' or 'const char *', and no matching literal operator template}}
-// expected-error at +9 {{no matching literal operator for call to 'operator""il' with argument of type 'unsigned long long' or 'const char *', and no matching literal operator template}}
-// expected-error at +9 {{invalid suffix 'ill' on integer constant}}
-#else
-// expected-error at +5 {{invalid suffix 'i' on integer constant}}
-// expected-error at +5 {{invalid suffix 'il' on integer constant}}
-// expected-error at +7 {{invalid suffix 'ill' on integer constant}}
-#endif
-
-_Complex int val1 = 2i;
-_Complex long val2 = 2il;
-_Complex long long val3 = 2ill;

Modified: cfe/trunk/test/SemaCXX/constexpr-printing.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constexpr-printing.cpp?rev=310426&r1=310425&r2=310426&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/constexpr-printing.cpp (original)
+++ cfe/trunk/test/SemaCXX/constexpr-printing.cpp Tue Aug  8 16:17:51 2017
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -std=gnu++11 -fsyntax-only -verify -triple x86_64-linux-gnu
+// RUN: %clang_cc1 %s -std=c++11 -fsyntax-only -verify -triple x86_64-linux-gnu
 
 struct S;
 constexpr int extract(const S &s);

Modified: cfe/trunk/unittests/AST/DeclTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/DeclTest.cpp?rev=310426&r1=310425&r2=310426&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/DeclTest.cpp (original)
+++ cfe/trunk/unittests/AST/DeclTest.cpp Tue Aug  8 16:17:51 2017
@@ -26,7 +26,7 @@ TEST(Decl, CleansUpAPValues) {
   // This is a regression test for a memory leak in APValues for structs that
   // allocate memory. This test only fails if run under valgrind with full leak
   // checking enabled.
-  std::vector<std::string> Args(1, "-std=gnu++11");
+  std::vector<std::string> Args(1, "-std=c++11");
   Args.push_back("-fno-ms-extensions");
   ASSERT_TRUE(runToolOnCodeWithArgs(
       Factory->create(),




More information about the cfe-commits mailing list