This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/41426] User defined conversion on return ignores array types
- From: "ville.voutilainen at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 14 Jul 2011 16:04:51 +0000
- Subject: [Bug c++/41426] User defined conversion on return ignores array types
- Auto-submitted: auto-generated
- References: <bug-41426-4@http.gcc.gnu.org/bugzilla/>
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.