This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/41426] User defined conversion on return ignores array types


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]