[LLVMbugs] [Bug 12006] New: Local const int cannot be used as an array bound in local struct

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 14 15:42:11 PST 2012


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

             Bug #: 12006
           Summary: Local const int cannot be used as an array bound in
                    local struct
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: matthewbg at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


void f() { 
  const int i = 5;
  struct S {
    int a[i];
  };
}

$ clang -std=c++11 -fsyntax-only test.cc
test.cc:4:11: error: reference to local variable 'i' declared in enclosing
function 'f'
    int a[i];
          ^
test.cc:2:13: note: 'i' declared here
  const int i = 5;
            ^

According to dgregor, "C++11 [class.local]p1 says it's valid 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