[llvm-bugs] [Bug 38140] New: Size of array is not checked

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 11 18:04:00 PDT 2018


            Bug ID: 38140
           Summary: Size of array is not checked
           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:

struct A
  constexpr operator int ()
    return 1;

template < int > struct B
  static constexpr A a = A();
  int ar[a];

clang++ accepts the code, but g++ rejects it:

error: size of array 'ar' has non-integral type 'const A'
   int ar[a];

The error message of g++ can present related bugs. Could clang++ also present
similar error messages?

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/20180712/542554dd/attachment-0001.html>

More information about the llvm-bugs mailing list