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