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: unassignedclangb...@nondot.org
          Reporter: alfred.w...@msn.com
                CC: dgre...@apple.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to