hubert.reinterpretcast added inline comments.
================ Comment at: clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/dtor.cpp:26 }; - struct Nonlit { Nonlit(); }; // expected-note {{not literal}} + struct Nonlit { // cxx2a-note {{'Nonlit' is not literal becaus}} + Nonlit(); ---------------- Typo still present. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:1-2 +// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected,cxx2a %s -fcxx-exceptions -triple=x86_64-linux-gnu -Wpre-c++2b-compat +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx2b %s -fcxx-exceptions -triple=x86_64-linux-gnu + ---------------- Flip `cxx2a` and `cxx2b` prefixes to match mode used. Add `-Wno-c++2b-extensions` since tests for those warnings are covered in `p3-2b.cpp`. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:8 + +#if __cplusplus > 202002 + ---------------- It's customary to have the `L` suffix in the context of checking `__cplusplus`. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:90 + +int non_literal_1 = non_literal(false); + ---------------- Evaluate as `constexpr`. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:116 + +int d = label(); + ---------------- Evaluate as `constexpr`. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:118 + +} // namespace eval_goto + ---------------- Move `#endif` to here (from below) so the explicitly-`constexpr` lambda cases are also tried in C++20 mode. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:120-121 + +// Test that explicitely constexpr lambdas behave correctly, +// This is to be constracted with the test for implicitely constexpr lambda below. +int test_in_lambdas() { ---------------- Fix typos. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:125 + static const int m = 32; // expected-note {{control flows through the declaration of a static variable}} \ + // expected-warning {{incompatible with C++ standards before C++2b}} + return m; ---------------- Adjust for suggested changes: do not expect C++2b mode warning in C++20 mode. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:132 + return 0; + static const int m = n; // expected-warning {{incompatible with C++ standards before C++2b}} + return m; ---------------- Adjust for suggested changes: do not expect C++2b mode warning in C++20 mode. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:141 + else + goto test; // expected-warning {{incompatible with C++ standards before C++2b}} \ + // expected-note {{subexpression not valid in a constant expression}} ---------------- Adjust for suggested changes: do not expect C++2b mode warning in C++20 mode. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:147-148 + c(0); + constexpr auto c_error = c(1); // expected-error {{constexpr variable 'c_error' must be initialized by a constant expression}} \ + // expected-note {{in call to}} + ---------------- Minor: Adjust alignment of comments. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:152 + if (!b) + NonLiteral n; // expected-note {{non-literal type 'NonLiteral' cannot be used in a constant expression}} + return 0; ---------------- Adjust for C++20/C++2b differences. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:156-158 + constexpr auto non_literal_ok = non_literal(false); // expected-error {{constexpr variable 'non_literal_ok' must be initialized by a constant expression}} \ + // expected-note {{in call}} + constexpr auto non_literal_ko = non_literal(true); ---------------- Guard calls to be C++2b only (since definition is not okay in C++20 mode). Adjust naming so that "ok" name is used for the C++2b-valid case. ================ Comment at: clang/test/SemaCXX/constant-expression-cxx2b.cpp:160-161 +} + +#endif + ---------------- Move `#endif` up so the explicitly-`constexpr` lambda cases are also tried in C++20 mode. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111400/new/ https://reviews.llvm.org/D111400 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits