Why do Clang and MSVC not like a member typedef declaration with a redundant set of parentheses?
Consider using foo = int; struct A { typedef A (foo)(); }; GCC and ICC accept the snippet, while Clang and MSVC reject it. Clang's error message is <source>:4:15: error: function cannot return function type 'void ()' typedef A (foo)(); ^ <source>:4:13: error: typedef name must be an identifier typedef A (foo)(); ^ 2 errors generated. And MSVC says <source>(4,15): error C2091: function returns function typedef A (foo)(); ^ (live demo) Why do Clang and MSVC produce this error? Which compilers are correct? (I'm specifically looking for quotation from the standard or any defect report.)
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.