https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114311
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- MSVC compiles it but Clang and EDG agree with GCC: $ clang++ c.cc -std=c++2b c.cc:12:22: error: non-type template argument is not a constant expression return SymbolRef<this->id_>{}; ^~~~~~~~~ c.cc:12:22: note: use of 'this' pointer is only allowed within the evaluation of a call to a 'constexpr' member function c.cc:20:29: error: call to consteval function 'Symbol::operator SymbolRef<1>' is not a constant expression static_cast<SymbolRef<1>>(x); ^ c.cc:13:3: note: control reached end of constexpr function } ^ c.cc:20:29: note: in call to '&x->operator SymbolRef()' static_cast<SymbolRef<1>>(x); ^ c.cc:20:3: warning: expression result unused [-Wunused-value] static_cast<SymbolRef<1>>(x); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning and 2 errors generated. $ edg --c++20 c.cc "c.cc", line 12: error: expression must have a constant value return SymbolRef<this->id_>{}; ^ "c.cc", line 12: note: the value of *this cannot be used as a constant return SymbolRef<this->id_>{}; ^ "c.cc", line 12: error: class "SymbolRef<1>" has no suitable copy constructor return SymbolRef<this->id_>{}; ^ detected during instantiation of "Symbol::operator SymbolRef<Id>() const [with Id=1]" at line 20 2 errors detected in the compilation of "c.cc".