[llvm-bugs] [Bug 37843] New: clang++ accept an ill-formed code sample

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 19 00:56:25 PDT 2018


            Bug ID: 37843
           Summary: clang++ accept an ill-formed code sample
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The code is as follow:

int main(int argc, char** argv)
 int x[1][argc];

 [&x](int i)
 x[0][i] = 0;

 return 0;

clang++ accepts the code, but g++ produces error messages:
capture of variably-modified type ‘int [1][argc]’ that is not an N3639 array of
runtime bound
because the array element type ‘int [argc]’ has variable size

It seems that g++ is right, and clang++ shall also provide similar error

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/20180619/1a75b72b/attachment-0001.html>

More information about the llvm-bugs mailing list