http://llvm.org/bugs/show_bug.cgi?id=12294
Bug #: 12294
Summary: Clang does not make a for-init-declaration hide a
class-name
Product: clang
Version: trunk
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++0x
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Clang does reject this:
int main() { for(int i = 0; i < 10; i++) { struct i { }; i++; } }
The spec is not completely clear in exactly what declarative region the "i"
variable and "i" class-name is put, but I derive:
- names declared by a for-init-declaration are in the same declarative region
as any name declared by the condition of a for-loop
- If a declaration in the outermost block of the for-loop redeclares the name
of a condition, that declaration is ill-formed. A redeclaration (as opposed to
a hiding) can only happen if both names were introduced into the same
declarative region.
The Standard says that if a class-name is introduced into the same declarative
region/scope as the name of a variable, the class-name is hidden. Hence I
expect that in the above, the "i++" increments the loop variable, and does not
resolve to the class-name (which makes clang reject the code).
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs