[llvm-bugs] [Bug 31605] New: Could clang report a more correct error message for in-class initializer for static data member?

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 11 01:47:03 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31605

            Bug ID: 31605
           Summary: Could clang report a more correct error message for
                    in-class initializer for static data member?
           Product: clang
           Version: 3.9
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: alfred.wang at msn.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

1 template <int N>
  2 class foo
  3 {
  4   public:
  5     static const int a = 3 / N;
  6 };
  7
  8 int main()
  9 {
 10    return foo<0>::a;
 11 }

gcc-6.1.0 reports:
msg.cpp:5:28: error: '(3 / 0)' is not a constant expression
     static const int a = 3 / N;
                          ~~^~~
While clang reports:
make_cpp11.cpp:5:28: error: in-class initializer for static data member is not
a constant expression
    static const int a = 3 / N;
                         ~~^~~

Could clang report the message like gcc reports '3 / 0'? Thanks.

-- 
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/20170111/c20d05fd/attachment.html>


More information about the llvm-bugs mailing list