[LLVMbugs] [Bug 12596] New: range-based for (N2930) ignores member access rules

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 19 13:44:25 PDT 2012


             Bug #: 12596
           Summary: range-based for (N2930) ignores member access rules
           Product: clang
           Version: 3.0
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: john at mcfarlane.name
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Observed in Xcode 4.3.2 console project with default debug build
settings/scheme and c++11 dialect turned on. Following C++ program... 

#include <iostream>

class C { int hidden [2] = { 1, 2 }; };

int main() {
    C o;
    for (int n : o.hidden)
        std::cout << n;
    return 0;

...compiles and produces output: "12". 

Expected behavior is that compiler produces error such as "'hidden' is a
private member of 'C'".

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