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

            Bug ID: 115121
           Summary: ++this is accepted in uninstantiated template
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

template<typename>
struct iter
{
  void operator++(int) {
    auto tmp = *this;
    ++this;
    return tmp;
  }
};

This has a typo, it should be ++*this

I assume this compiles because `this` is dependent, but we could reject it
earlier. Incrementing `this` is never valid, it doesn't matter how the template
is instantiated.

Reply via email to