Qizhi Hu 156ab4d4fb
[Clang][Sema] set declaration invalid earlier to prevent crash in calculating record layout (#87173)
Try to fix https://github.com/llvm/llvm-project/issues/75221
This crash caused by calculating record layout which contains a field
declaration with dependent type. Make it invalid before it is a complete
definition to prevent this crash. Define a new scope type to record this
type alias and set the record declaration invalid when it is defined in
a type alias template.

Co-authored-by: huqizhi <836744285@qq.com>
2024-04-18 08:52:25 +08:00

7 lines
195 B
C++

// RUN: %clang_cc1 -verify -std=c++11 -fsyntax-only %s
template <class T> using foo = struct foo { // expected-error {{'foo' cannot be defined in a type alias template}}
T size = 0;
};
foo a;