[PATCH] D86048: [AST][RecoveryExpr] Popagate the error-bit from a VarDecl's initializer to DeclRefExpr.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 18 06:56:28 PDT 2020
hokein updated this revision to Diff 286274.
hokein added a comment.
update.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86048/new/
https://reviews.llvm.org/D86048
Files:
clang/lib/AST/ComputeDependence.cpp
clang/test/Sema/invalid-member.cpp
clang/test/SemaCXX/invalid-template-base-specifier.cpp
Index: clang/test/SemaCXX/invalid-template-base-specifier.cpp
===================================================================
--- clang/test/SemaCXX/invalid-template-base-specifier.cpp
+++ clang/test/SemaCXX/invalid-template-base-specifier.cpp
@@ -26,3 +26,10 @@
};
void test3() { Crash3<int>(); } // expected-note {{in instantiation of template class}}
+
+constexpr int N = undef; // expected-error {{use of undeclared identifier}}
+
+class Crash4 : decltype(N) {
+};
+
+static_assert(sizeof(Crash4) == 1, "");
Index: clang/test/Sema/invalid-member.cpp
===================================================================
--- clang/test/Sema/invalid-member.cpp
+++ clang/test/Sema/invalid-member.cpp
@@ -19,3 +19,10 @@
};
// Should be able to evaluate sizeof without crashing.
static_assert(sizeof(Z) == 1, "No valid members");
+
+constexpr int N = undef; // expected-error {{use of undeclared identifier}}
+
+class T {
+ decltype(N) member;
+};
+static_assert(sizeof(T) == 1, "No valid members");
Index: clang/lib/AST/ComputeDependence.cpp
===================================================================
--- clang/lib/AST/ComputeDependence.cpp
+++ clang/lib/AST/ComputeDependence.cpp
@@ -466,10 +466,12 @@
: Var->getType()->isIntegralOrEnumerationType()) &&
(Var->getType().isConstQualified() ||
Var->getType()->isReferenceType())) {
- if (const Expr *Init = Var->getAnyInitializer())
- if (Init->isValueDependent()) {
+ if (const Expr *Init = Var->getAnyInitializer()) {
+ if (Init->isValueDependent())
Deps |= ExprDependence::ValueInstantiation;
- }
+ if (Init->containsErrors())
+ Deps |= ExprDependence::Error;
+ }
}
// (VD) - FIXME: Missing from the standard:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86048.286274.patch
Type: text/x-patch
Size: 1790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200818/2dff1806/attachment.bin>
More information about the cfe-commits
mailing list