Summary: We don't know what context to use until the classification result is consumed by the parser, which could happen in a different semantic context. So don't build the expression that results from name classification until we get to that point and can handle it properly. This covers everything except C++ implicit class member access, which is a little awkward to handle properly in the face of the protected member access check. But it at least fixes all the currently-filed instances of PR43080. Reviewers: efriedma Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68896 llvm-svn: 374826
26 lines
607 B
C++
26 lines
607 B
C++
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
// Don't crash.
|
|
|
|
struct g {
|
|
j; // expected-error {{C++ requires a type specifier for all declarations}}
|
|
};
|
|
|
|
void captures_invalid_type() {
|
|
g child;
|
|
auto q = [child]{};
|
|
const int n = sizeof(q);
|
|
}
|
|
|
|
void captures_invalid_array_type() {
|
|
g child[100];
|
|
auto q = [child]{};
|
|
const int n = sizeof(q);
|
|
}
|
|
|
|
int pr43080(int i) { // expected-note {{declared here}}
|
|
return [] { // expected-note {{begins here}}
|
|
return sizeof i <
|
|
i; // expected-error {{variable 'i' cannot be implicitly captured in a lambda with no capture-default specified}}
|
|
}();
|
|
}
|