Why clang++37 behaves differently on 9.3 and 10.3?

Yuri yuri at rawbw.com
Thu May 12 11:33:43 UTC 2016

clang++37 compiles this simple program fine on 10.3, but fails on 9.3.

Why does it behave differently on different OS versions?

It looks like it ignores -std=c++11 on 9.3.


#include <limits>

int main() {
   const int vmax = std::numeric_limits<int>::max();
   static_assert(vmax>0, "");

clang++37 -std=c++11 -c test.cc

---error on 9.3---
test.cc:6:17: error: static_assert expression is not an integral 
constant expression
   static_assert(vmax>0, "");
test.cc:6:17: note: initializer of 'vmax' is not a constant expression
test.cc:5:13: note: declared here
   const int vmax = std::numeric_limits<int>::max();
1 error generated.

More information about the freebsd-ports mailing list