[LLVMbugs] [Bug 12293] New: Rejects valid shadowing of a for-range-declaration

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 17 05:30:30 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12293

             Bug #: 12293
           Summary: Rejects valid shadowing of a for-range-declaration
           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


There appears to be nothing in the spec that forbids this:

    int a[] = { 1, 2 };
    for(int b : a) {
      int b;
    }

While for normal for-loops, their for-range-declaration is in the same
declarative region as names declared by the loop condition, which in turn is in
the same declarative region as all declarations in the outermost block of the
loop, I find no such thing for range-based for loops. 

Clang follows GCC and rejects this testcase, but both are not
Standards-conforming if they behave this way and the spec allows such 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