https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94590
Bug ID: 94590
Summary: Incorrectly accepts invalid C++11 braced
initialisation of double from long double if
sizeof(long double)==sizeof(double)
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dangelog at gmail dot com
CC: dangelog at gmail dot com, marc at kdab dot com,
unassigned at gcc dot gnu.org
Target Milestone: ---
+++ This bug was initially created as a clone of Bug #92856 +++
(Sorry, couldn't find a way to reopen _that_ bug, so creating a new one)
Hi,
When using list-initialization from a long double to double, GCC warns (and
rejects the code in SFINAE contexts) only on platforms where sizeof(long
double) > sizeof(double). This is OK, and documented.
However: on platforms where long double is the same as double, GCC incorrectly
accepts the code without emitting warnings, and affecting SFINAE.
For instance
* On ARM: https://godbolt.org/z/SRg3fr
* On X86-64 also passing -mlong-double-64: https://godbolt.org/z/GnRkHC
SFINAE contexts are affected as well: https://godbolt.org/z/icMA3k
Clang, MSVC reject the code.