[LLVMbugs] [Bug 19244] New: -Wvla-extension warning incorrectly generated

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 25 10:05:50 PDT 2014


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

            Bug ID: 19244
           Summary: -Wvla-extension warning incorrectly generated
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: michael at ensslin.cc
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In the following minimal example, f() incorrectly causes a warning, while g()
and h() correctly do not.
In g++, no warning is generated.

I assume that the warning is generated because LLVM doesn't notice that this->x
is constexpr. 

mic at mic-nb $ cat test.cpp
struct A {
    static constexpr int x = 5;

    void f() {
        int a[this->x]; //warning
    }

    void g() {
        int a[x];       //no warning
    }

    void h() {
        int a[A::x];    //no warning
    }
};
mic at mic-nb $ clang++ -std=c++11 -Wvla-extension -c test.cpp
test.cpp:5:8: warning: variable length arrays are a C99 feature
[-Wvla-extension]
                int a[this->x]; //warning
                     ^
1 warning generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140325/c0b0126e/attachment.html>


More information about the llvm-bugs mailing list