Fun with pathological templates

54 προβολές
Παράβλεψη και μετάβαση στο πρώτο μη αναγνωσμένο μήνυμα

Matthew Woehlke

μη αναγνωσμένη,
15 Ιουν 2018, 3:48:14 μ.μ.15/6/18
ως 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

μη αναγνωσμένη,
15 Ιουν 2018, 4:47:24 μ.μ.15/6/18
ως 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.

Απάντηση σε όλους
Απάντηση στον συντάκτη
Προώθηση
0 νέα μηνύματα