[PATCH] D78116: [AST] dont invaliate VarDecl when the initializer contains errors.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 16 15:04:52 PDT 2020
sammccall added a comment.
Most of the new diagnostics look good, as you say.
I'm okay with the regression around foreach loops, given that:
- per rsmith, the mechanism behind this diagnostic was misdesigned (relying on initializer making things invalid)
- it's a C++-only features and we should be able to flip on recoveryexpr for C++ soon
================
Comment at: clang/test/SemaCXX/constant-expression-cxx11.cpp:880
constexpr Base *nullB1 = 0;
-static_assert((Bottom*)nullB == 0, "");
-static_assert((Derived*)nullB == 0, "");
-static_assert((void*)(Bottom*)nullB == (void*)(Derived*)nullB, "");
+static_assert((Bottom*)nullB == 0, ""); // expected-error {{static_assert expression is not an integral constant expression}}
+static_assert((Derived*)nullB == 0, ""); // expected-error {{static_assert expression is not an integral constant expression}}
----------------
I'm not *sure* what the purpose of these test is, but my guess is they're mostly trying to test nullpointer comparisons not error recovery. maybe we should have 1 with nullB and the error, and the rest use nullB1?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78116/new/
https://reviews.llvm.org/D78116
More information about the cfe-commits
mailing list