https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119020
Bug ID: 119020 Summary: Problem of constexpr static lambda and maybe GCC accepts invalid Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: qurong at ios dot ac.cn Target Milestone: --- For this program: ``` struct TestClass { void testFinction() {} static TestClass* ptr_; constexpr static auto funcPtr = +[](){ ptr_->testFinction(); }; }; TestClass* TestClass::ptr_ = new TestClass(); int main() { return 0; } ``` This causes an error in clang, but GCC didn't report the error. Compiler Explorer link: https://godbolt.org/z/x9bYrGqTn