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

            Bug ID: 94309
           Summary: Fail to find post-increment operator in templated
                    function
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: romain.geissler at amadeus dot com
  Target Milestone: ---

Hi,

This snippet started to fail recently with gcc trunk. Note, it was working fine
with "g++ (GCC) 10.0.1 20200305", and it works fine with gcc <= 9, and all
clang versions


struct A
{
    int _i;

    operator int&()
    {
        return _i;
    }
};

void f()    
{     
    A a;
    a++; // works
}

template <typename T> void f()
{
    A a;
    a++; // fails
}


The error is:

#2 with x86-64 gcc (trunk)
<source>: In function 'void f()':
<source>:20:6: error: no post-increment operator for type
   20 |     a++; // fails
      |      ^~
Compiler returned: 1


Cheers,
Romain

Reply via email to