Crash in CodeGenTypes::ConvertTypeForMem for a static array member with a dependent nested-alias element type missing typename
Description
Variant of the same ill-typed static member pattern with an array member — taking the address of the static array crashes in a different CodeGen function:
template <class T>
struct Tester {
struct Inner { using T2 = int; };
};
template <class T>
struct W { static Tester<T>::Inner::T2 m[2]; };
template <class T>
Tester<T>::Inner::T2 W<T>::m[2] = {1, 2};
template struct W<int>;
clang++ -std=c++17 -c repro.cpp
Expected / Observed
Expected: a diagnostic error (missing typename, as GCC produces).
Observed: crash with stack dump at
clang::CodeGen::CodeGenTypes::ConvertTypeForMem (CodeGenTypes.cpp:107),
reached from GetAddrOfGlobalVar ← HandleCXXStaticMemberVarInstantiation.
Every optimization level; also Clang 19.1.7.
@llvm/issue-subscribers-clang-codegen
Author: ICSE-27
Variant of the same ill-typed static member pattern with an array member — taking the address of the static array crashes in a different CodeGen function:
template <class T>
struct Tester {
struct Inner { using T2 = int; };
};
template <class T>
struct W { static Tester<T>::Inner::T2 m[2]; };
template <class T>
Tester<T>::Inner::T2 W<T>::m[2] = {1, 2};
template struct W<int>;
clang++ -std=c++17 -c repro.cpp
Expected / Observed
Expected: a diagnostic error (missing typename, as GCC produces).
Observed: crash with stack dump at
clang::CodeGen::CodeGenTypes::ConvertTypeForMem (CodeGenTypes.cpp:107),
reached from GetAddrOfGlobalVar ← HandleCXXStaticMemberVarInstantiation.
Every optimization level; also Clang 19.1.7.