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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-02-13
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
      Known to fail|                            |4.9.1, 5.1.0, 6.1.0, 7.0

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, GCC 4.9.x created an invalid code:

/tmp/ccMxhwLo.s: Assembler messages:
/tmp/ccMxhwLo.s:170: Error: symbol `_ZN7FunjectcvDaEv' is already defined

while as Honza fixed comdat group verifier in r221736, we report the
aforementioned error.

I guess the proper fix is to reject the code as clang does:

$ clang++ pr79474.cpp -c -std=c++14
pr79474.cpp:4:9: error: conversion function cannot be redeclared
        operator auto() { return +[](bool b, bool, bool) {return b;}; }
        ^
pr79474.cpp:3:9: note: previous declaration is here
        operator auto() { return +[](bool b) {return b;}; }
        ^
pr79474.cpp:4:34: error: cannot initialize return object of type 'auto' with an
rvalue of type 'bool (*)(bool, bool, bool)'
        operator auto() { return +[](bool b, bool, bool) {return b;}; }
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pr79474.cpp:9:17: error: no matching function for call to object of type
'Funject'
    auto bbbb = fun(true, false, true);
                ^~~
pr79474.cpp:3:9: note: conversion candidate of type 'bool (*)(bool)'
        operator auto() { return +[](bool b) {return b;}; }
        ^
3 errors generated.

Reply via email to