https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92856
Bug ID: 92856 Summary: incorrectly accepts invalid C++11 braced initialisation of double from long double Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: marc at kdab dot com Target Milestone: --- The following code: // https://godbolt.org/z/tWa2dr int main() { extern long double ld; double d{ld}; } is invalid according to [dcl.list.init]3.9 (http://eel.is/c++draft/dcl.init.list#3.9): regardless of a target's actual size for these types, long double -> double is considered a narrowing conversion [dcl.list.init]/7 (http://eel.is/c++draft/dcl.init.list#7.2), and the compiler cannot use the constant expression loophole here. Clang and MSVC correctly error on this. Actual behaviour: GCC only warns (-Wnarrowing), even with -pedantic. Expected behaviour: GCC does not accept this code. This bug exists in all compiler versions, afaict (4.7.4, 4.8.3, 9.1, trunk).