https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114311

Carlo Wood <carlo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|wrong "error: ‘this’ is not |Possibly wrong "error:
                   |a constant expression" with |‘this’ is not a constant
                   |consteval member function   |expression" with consteval
                   |                            |member function

--- Comment #1 from Carlo Wood <carlo at gcc dot gnu.org> ---
I stand corrected. When adding `this->` it is still giving an error when trying
to instantiate the template member function.

For example:

```
template<int Id>
struct SymbolRef { };

struct Symbol {
  int const id_;

  consteval Symbol() : id_(1) { }

  template<int Id>
  consteval operator SymbolRef<Id>() const
  {
    return SymbolRef<this->id_>{};
  }
};

int main()
{
  Symbol x;

  static_cast<SymbolRef<1>>(x);
}
```

Gives an equivalent error, despite the `this->`.
I am not certain anymore if this is a wrong error.

Reply via email to