This compiles in clang , but not in gcc :
void f(int x = decltype(x){});
A bug in gcc says that x not declared in this scope, but according to 3.3.2 / 1, the variable x should be in scope:
The declaration point for the name immediately after its full declaration (section 8) and before its initializer (if any), except as noted below. [Example:
int x = 12; { int x = x; }
Here the second x initialized with its own (undefined) value. - end of example]
So right? Should x be available in its own initializer?
PS: int x = x as a parameter does not work in both compilers, but I do not know why.
c ++ language-lawyer c ++ 11
template boy
source share