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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2020-01-30
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Using current master, I see:

$ g++ pr92340.cc -c
pr92340.cc: In function ‘void f1()’:
pr92340.cc:12:6: error: passing ‘const C’ as ‘this’ argument discards
qualifiers [-fpermissive]
   12 |  c.f();
      |      ^
pr92340.cc:5:8: note:   in call to ‘void C::f()’
    5 |   void f() {}
      |        ^
pr92340.cc: In function ‘int main()’:
pr92340.cc:16:5: error: expected primary-expression before ‘int’
   16 |  f1<int>();
      |     ^~~

Clang says:

$ clang++ pr92340.cc -c
pr92340.cc:12:2: error: 'this' argument to member function 'f' has type 'const
C', but function is not marked const
        c.f();
        ^
pr92340.cc:5:8: note: 'f' declared here
                void f() {}
                     ^
pr92340.cc:16:2: error: 'f1' does not name a template but is followed by
template arguments
        f1<int>();
        ^ ~~~~~
pr92340.cc:9:6: note: non-template declaration found by name lookup
void f1() {
     ^
2 errors generated.

What's wrong about this?

Reply via email to