Summary: The field decl (in the testcase) was still valid, which results in a valid RecordDecl, it led to crash when performing struct layout, and computing struct size etc. Reviewers: sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D81913
22 lines
761 B
C++
22 lines
761 B
C++
// RUN: %clang_cc1 -verify -fsyntax-only -fno-recovery-ast %s
|
|
// RUN: %clang_cc1 -verify -fsyntax-only -frecovery-ast %s
|
|
|
|
void foo(); // expected-note 2{{requires 0 arguments}}
|
|
class X {
|
|
decltype(foo(42)) invalid; // expected-error {{no matching function}}
|
|
};
|
|
// Should be able to evaluate sizeof without crashing.
|
|
static_assert(sizeof(X) == 1, "No valid members");
|
|
|
|
class Y {
|
|
typeof(foo(42)) invalid; // expected-error {{no matching function}}
|
|
};
|
|
// Should be able to evaluate sizeof without crashing.
|
|
static_assert(sizeof(Y) == 1, "No valid members");
|
|
|
|
class Z {
|
|
int array[sizeof(invalid())]; // expected-error {{use of undeclared identifier}}
|
|
};
|
|
// Should be able to evaluate sizeof without crashing.
|
|
static_assert(sizeof(Z) == 1, "No valid members");
|