https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94926
Bug ID: 94926
Summary: [9 regression] invalid use of incomplete type not
recogniced for static self reference of templated
struct
Product: gcc
Version: 9.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
The following illegal code, correctly rejected by GCC 8.3, compiles from GCC
9.1 onwards (only checking compiler version available on Compiler Explorer),
see https://godbolt.org/z/rfD8sF
================================
template<typename>
struct A {
static auto self_reference = A{};
};
int main() {
A<void>{};
}
================================
When specifying the injected class name or removing all templates, the code is
rejected as expected.