Fun with pathological templates

54 megtekintés
Ugrás az első olvasatlan üzenetre

Matthew Woehlke

olvasatlan,
2018. jún. 15. 15:48:142018. 06. 15.
– ISO C++ Standard - Discussion
Is this valid C++?

template <typename T> struct x {};
x<int(&)[5>8?7:9]> freaky;

Clang says yes, gcc says "template argument 1 is invalid". Who is correct?

--
Matthew

bogdan

olvasatlan,
2018. jún. 15. 16:47:242018. 06. 15.
– ISO C++ Standard - Discussion
I guess it hinges on what "nested" means in [temp.names]/3, and there's a CWG issue on that: CWG579.

EDG accepts it, MSVC rejects it. Both GCC and MSVC accept it if you enclose the array bound in parentheses.

Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet