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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang gets it fully wrong anyways, take:
struct S {
    template<class T=void>
    operator auto() const  { return T{}; }
};

int main() {
    S s;
    [[maybe_unused]] int d = (int)s;
}
----- CUT ----
clang produces:
<source>:3:38: error: illegal initializer type 'void'
    operator auto() const  { return T{}; }
                                     ^
<source>:8:35: note: in instantiation of function template specialization
'S::operator auto<void>' requested here
    [[maybe_unused]] int d = (int)s;
                                  ^
<source>:8:30: error: no matching conversion for C-style cast from 'S' to 'int'
    [[maybe_unused]] int d = (int)s;
                             ^~~~~~
<source>:3:5: note: candidate template ignored: substitution failure [with T =
void]
    operator auto() const  { return T{}; }
    ^

----- CUT ----
There should be no instantiation of the template here at all.

Reply via email to