r369281 - Implement P1668R1
Leonard Chan via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 19 11:33:00 PDT 2019
Not sure if this was caught by upstream bots already, but we're seeing a
failing test ob our x64 bots:
```
FAIL: Clang :: SemaCXX/cxx1z-constexpr-lambdas.cpp (9574 of 15387)
******************** TEST 'Clang :: SemaCXX/cxx1z-constexpr-lambdas.cpp'
FAILED ********************
Script:
--
: 'RUN: at line 1';
/b/s/w/ir/k/recipe_cleanup/clangAGxiPQ/llvm_build_dir/bin/clang -cc1
-internal-isystem
/b/s/w/ir/k/recipe_cleanup/clangAGxiPQ/llvm_build_dir/lib/clang/10.0.0/include
-nostdsysteminc -std=c++1z -verify -fsyntax-only -fblocks
/b/s/w/ir/k/llvm-project/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
-fcxx-exceptions
: 'RUN: at line 2';
/b/s/w/ir/k/recipe_cleanup/clangAGxiPQ/llvm_build_dir/bin/clang -cc1
-internal-isystem
/b/s/w/ir/k/recipe_cleanup/clangAGxiPQ/llvm_build_dir/lib/clang/10.0.0/include
-nostdsysteminc -std=c++2a -verify -fsyntax-only -fblocks
/b/s/w/ir/k/llvm-project/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
-fcxx-exceptions
: 'RUN: at line 3';
/b/s/w/ir/k/recipe_cleanup/clangAGxiPQ/llvm_build_dir/bin/clang -cc1
-internal-isystem
/b/s/w/ir/k/recipe_cleanup/clangAGxiPQ/llvm_build_dir/lib/clang/10.0.0/include
-nostdsysteminc -std=c++1z -verify -fsyntax-only -fblocks
-fdelayed-template-parsing
/b/s/w/ir/k/llvm-project/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
-fcxx-exceptions
: 'RUN: at line 4';
/b/s/w/ir/k/recipe_cleanup/clangAGxiPQ/llvm_build_dir/bin/clang -cc1
-internal-isystem
/b/s/w/ir/k/recipe_cleanup/clangAGxiPQ/llvm_build_dir/lib/clang/10.0.0/include
-nostdsysteminc -std=c++14 -verify -fsyntax-only -fblocks
/b/s/w/ir/k/llvm-project/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
-DCPP14_AND_EARLIER -fcxx-exceptions
--
Exit Code: 1
Command Output (stderr):
--
error: 'error' diagnostics expected but not seen:
File
/b/s/w/ir/k/llvm-project/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
Line 26 (directive at
/b/s/w/ir/k/llvm-project/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp:28):
use of this statement in a constexpr function is a C++2a extension
error: 'warning' diagnostics seen but not expected:
File
/b/s/w/ir/k/llvm-project/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
Line 26: use of this statement in a constexpr function is a C++2a extension
2 errors generated.
--
********************
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 79.76s
********************
Failing Tests (1):
Clang :: SemaCXX/cxx1z-constexpr-lambdas.cpp
```
Could you look into this? Thanks.
On Mon, Aug 19, 2019 at 10:39 AM Erich Keane via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
> Author: erichkeane
> Date: Mon Aug 19 10:39:59 2019
> New Revision: 369281
>
> URL: http://llvm.org/viewvc/llvm-project?rev=369281&view=rev
> Log:
> Implement P1668R1
>
> Allow inline assembly statements in unexecuted branches of constexpr
> functions.
>
> Modified:
> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
> cfe/trunk/test/Lexer/cxx-features.cpp
> cfe/trunk/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
>
> Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=369281&r1=369280&r2=369281&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
> +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Mon Aug 19 10:39:59 2019
> @@ -480,6 +480,7 @@ static void InitializeCPlusPlusFeatureTe
> Builder.defineMacro("__cpp_user_defined_literals", "200809L");
> Builder.defineMacro("__cpp_lambdas", "200907L");
> Builder.defineMacro("__cpp_constexpr",
> + LangOpts.CPlusPlus2a ? "201907L" :
> LangOpts.CPlusPlus17 ? "201603L" :
> LangOpts.CPlusPlus14 ? "201304L" : "200704");
> Builder.defineMacro("__cpp_range_based_for",
>
> Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=369281&r1=369280&r2=369281&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Aug 19 10:39:59 2019
> @@ -1995,6 +1995,9 @@ CheckConstexprFunctionStmt(Sema &SemaRef
> return false;
> return true;
>
> + case Stmt::GCCAsmStmtClass:
> + case Stmt::MSAsmStmtClass:
> + // C++2a allows inline assembly statements.
> case Stmt::CXXTryStmtClass:
> if (Cxx2aLoc.isInvalid())
> Cxx2aLoc = S->getBeginLoc();
>
> Modified: cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp?rev=369281&r1=369280&r2=369281&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp (original)
> +++ cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp Mon Aug 19
> 10:39:59 2019
> @@ -136,9 +136,13 @@ constexpr int AllowedStmtsCXX11() {
> }
>
> // or a compound-statement that does not contain [CXX1Y]
> -constexpr int DisallowedStmtsCXX1Y_1() {
> +constexpr int DisallowedStmtsCXX1Y_1(bool b) {
> // - an asm-definition
> - asm("int3"); // expected-error {{statement not allowed in constexpr
> function}}
> + if (b)
> + asm("int3");
> +#if !defined(CXX2A)
> + // expected-error at -2 {{use of this statement in a constexpr function
> is a C++2a extension}}
> +#endif
> return 0;
> }
> constexpr int DisallowedStmtsCXX1Y_2() {
>
> Modified: cfe/trunk/test/Lexer/cxx-features.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx-features.cpp?rev=369281&r1=369280&r2=369281&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/Lexer/cxx-features.cpp (original)
> +++ cfe/trunk/test/Lexer/cxx-features.cpp Mon Aug 19 10:39:59 2019
> @@ -203,7 +203,7 @@
> #error "wrong value for __cpp_lambdas"
> #endif
>
> -#if check(constexpr, 0, 200704, 201304, 201603, 201603)
> +#if check(constexpr, 0, 200704, 201304, 201603, 201907)
> #error "wrong value for __cpp_constexpr"
> #endif
>
>
> Modified: cfe/trunk/test/SemaCXX/cxx1z-constexpr-lambdas.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1z-constexpr-lambdas.cpp?rev=369281&r1=369280&r2=369281&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/cxx1z-constexpr-lambdas.cpp (original)
> +++ cfe/trunk/test/SemaCXX/cxx1z-constexpr-lambdas.cpp Mon Aug 19 10:39:59
> 2019
> @@ -23,7 +23,10 @@ namespace ns1 {
> } // end ns1
>
> namespace ns2 {
> - auto L = [](int I) constexpr { asm("non-constexpr"); };
> //expected-error{{not allowed in constexpr function}}
> + auto L = [](int I) constexpr { if (I == 5) asm("non-constexpr"); };
> +#if __cpp_constexpr < 201907L
> + //expected-error at -2{{use of this statement in a constexpr function is
> a C++2a extension}}
> +#endif
> } // end ns1
>
> // This is not constexpr until C++20, as the requirements on constexpr
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190819/132faf62/attachment-0001.html>
More information about the cfe-commits
mailing list