https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81311
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Status|UNCONFIRMED |NEW Last reconfirmed| |2017-09-14 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- extern "C" int puts(const char*); struct function { function() { puts("function()"); } template<class F> function( F ) { puts("function<F>(F)"); } function( function const& ) { puts("function(function const&)"); } }; struct ref { ref() = default; operator function&() const; }; int main() { function f2( ref{} ); } Compiles OK with C++14, printing "function<F>(F)" but fails to link with C++17: /tmp/ccB3mFFt.o: In function `main': /tmp/ref.cc:30: undefined reference to `ref::operator function&() const' collect2: error: ld returned 1 exit status Presumably caused by the changes for guaranteed elision in C++17. Interestingly if the conversion operator is defined as deleted then it compiles OK, choosing the function<F>(F) constructor instead.