[LLVMbugs] [Bug 12294] New: Clang does not make a for-init-declaration hide a class-name
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Mar 17 05:51:18 PDT 2012
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: unassignedclangbugs at nondot.org
ReportedBy: schaub.johannes at googlemail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
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.
More information about the llvm-bugs
mailing list