[Bug c++/41426] User defined conversion on return ignores array types
ville.voutilainen at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 14 16:05:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41426
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ville.voutilainen at gmail
| |dot com
--- Comment #1 from Ville Voutilainen <ville.voutilainen at gmail dot com> 2011-07-14 16:04:11 UTC ---
gcc 4.7 (trunk) still behaves this way. An example snippet
was provided for me:
struct v
{
template<unsigned N>
v( const char(&)[N] ){}
};
v foo( )
{
return "Hello WOrld"; // #1
}
int main ( )
{
v x("hello world"); // #2
}
in that snippet, #1 is rejected with
error: could not convert ‘(const char*)"Hello WOrld"’ from ‘const char*’ to ‘v’
Explicit construction of v in foo() works.
More information about the Gcc-bugs
mailing list