xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/warn-static-const-float.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify %s -std=c++98 -DEXT
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify %s -std=c++98 -Wno-gnu -DNONE
3*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify %s -std=c++98 -Wno-static-float-init -DNONE
4*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify %s -std=c++98 -Wno-gnu-static-float-init -DNONE
5*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify %s -std=c++11 -DERR
6*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify %s -std=c++11 -Wno-gnu -DERR
7*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify %s -std=c++11 -Wno-static-float-init -DNONE
8*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -verify %s -std=c++11 -Wno-gnu-static-float-init -DERR
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc #if NONE
11*f4a2713aSLionel Sambuc // expected-no-diagnostics
12*f4a2713aSLionel Sambuc #elif ERR
13*f4a2713aSLionel Sambuc // expected-error@20 {{in-class initializer for static data member of type 'const double' requires 'constexpr' specifier}}
14*f4a2713aSLionel Sambuc // expected-note@20 {{add 'constexpr'}}
15*f4a2713aSLionel Sambuc #elif EXT
16*f4a2713aSLionel Sambuc // expected-warning@20 {{in-class initializer for static data member of type 'const double' is a GNU extension}}
17*f4a2713aSLionel Sambuc #endif
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc struct X {
20*f4a2713aSLionel Sambuc   static const double x = 0.0;
21*f4a2713aSLionel Sambuc };
22