[Bug c++/40942] GCC accepts code that Comeau and MSVC deems invalid.

v dot haisman at sh dot cvut dot cz gcc-bugzilla@gcc.gnu.org
Tue Aug 25 14:20:00 GMT 2009



------- Comment #3 from v dot haisman at sh dot cvut dot cz  2009-08-25 14:20 -------
(In reply to comment #2)
> Why would this be ambiguous? A string literal has type "array of n const char"
> (see 2.13.4/1), so it should go with the array constructor. Do you disagree?
> 
> W.
> 
IANALL, but I think this might be the reason:

The conversion sequence for S (T const *) is array-to-pointer conversion as per
4.2. The conversion sequence for S (char const (&)[N]) is lvalue-to-rvalue
conversion. For both the ranks are the exact match and thus they are
indistinguishable conversion sequences as per 13.3.3.2?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40942



More information about the Gcc-bugs mailing list