Don't warn about runtime behavior problems in variable initializers that weknow are going to be constant-evaluated.Any relevant diagnostics should be produced by constant expression evaluation.l
Don't warn about runtime behavior problems in variable initializers that weknow are going to be constant-evaluated.Any relevant diagnostics should be produced by constant expression evaluation.llvm-svn: 314067
show more ...
Implement C++17 P0386R2, inline variables. (The 'inline' specifier gives avariable weak discardable linkage and partially-ordered initialization, and isimplied for constexpr static data members.)
Implement C++17 P0386R2, inline variables. (The 'inline' specifier gives avariable weak discardable linkage and partially-ordered initialization, and isimplied for constexpr static data members.)llvm-svn: 273754
Provide better diagnostic wording for initializers on staticdata member definitions when the variable has an initializerin its declaration.For the following code: struct S { static const i
Provide better diagnostic wording for initializers on staticdata member definitions when the variable has an initializerin its declaration.For the following code: struct S { static const int x = 42; }; const int S::x = 42;This patch changes the diagnostic from: a.cc:4:14: error: redefinition of 'x' const int S::x = 42; ^ a.cc:2:20: note: previous definition is here static const int x = 42; ^to: a.cc:4:18: error: static data member 'x' already has an initializer const int S::x = 42; ^ a.cc:2:24: note: previous initialization is here static const int x = 42; ^Differential Revision: http://llvm-reviews.chandlerc.com/D2235llvm-svn: 195306
Move -Wstatic-float-init fixit into a note & don't recover as if constexprllvm-svn: 173841
Sync 'in class initialization of static const double' extension up with GCC,and split it out of -Wgnu into its own warning flag. * In C++11, this is now a hard error (GCC has no extension here in
Sync 'in class initialization of static const double' extension up with GCC,and split it out of -Wgnu into its own warning flag. * In C++11, this is now a hard error (GCC has no extension here in C++11 mode). The error can be disabled with -Wno-static-float-init, and has a fixit to add 'constexpr'. * In C++98, this is still an ExtWarn, but is now controlled by -Wstatic-float-init as well as -Wgnu.llvm-svn: 173414
Deal with a horrible C++11 special case. If a non-literal type has a constexprconstructor, and that constructor is used to initialize an object of staticstorage duration such that all members and b
Deal with a horrible C++11 special case. If a non-literal type has a constexprconstructor, and that constructor is used to initialize an object of staticstorage duration such that all members and bases are initialized by constantexpressions, constant initialization is performed. In this case, the objectcan still have a non-trivial destructor, and if it does, we must emit a dynamicinitializer which performs no initialization and instead simply registers thatdestructor.llvm-svn: 150419
Update constexpr implementation to match CWG's chosen approach for core issues1358, 1360, 1452 and 1453. - Instantiations of constexpr functions are always constexpr. This removes the need for s
Update constexpr implementation to match CWG's chosen approach for core issues1358, 1360, 1452 and 1453. - Instantiations of constexpr functions are always constexpr. This removes the need for separate declaration/definition checking, which is now gone. - This makes it possible for a constexpr function to be virtual, if they are only dependently virtual. Virtual calls to such functions are not constant expressions. - Likewise, it's now possible for a literal type to have virtual base classes. A constexpr constructor for such a type cannot actually produce a constant expression, though, so add a special-case diagnostic for a constructor call to such a type rather than trying to evaluate it. - Classes with trivial default constructors (for which value initialization can produce a fully-initialized value) are considered literal types. - Classes with volatile members are not literal types. - constexpr constructors can be members of non-literal types. We do not yet use static initialization for global objects constructed in this way.llvm-svn: 150359
Further testing for instantiation of out-of-line constexpr static data membertemplate definitions.llvm-svn: 148506
An instantiation of a constexpr static data member in a class template isconstexpr.llvm-svn: 148505
constexpr: static data members declared constexpr are required to have aninitializer; all other constexpr variables are merely required to beinitialized. In particular, a user-provided constexpr de
constexpr: static data members declared constexpr are required to have aninitializer; all other constexpr variables are merely required to beinitialized. In particular, a user-provided constexpr default constructor can beused for such initialization.llvm-svn: 144028
Update all tests other than Driver/std.cpp to use -std=c++11 rather than-std=c++0x. Patch by Ahmed Charles!llvm-svn: 141900
PR11067: A definition of a constexpr static variable doesn't need an initializer if the in-class declaration had one. Such a declaration must be initialized by a constant expression.llvm-svn: 141279
Suggest adding 'constexpr' if the GNU extension for in-class initializers for static const float members is used in C++11 mode.llvm-svn: 140828
Mark the ExtWarn for in-class initialization of static const float members as a GNU extension. Don't extend the scope of this extension to all literal types in C++0x mode.llvm-svn: 140820
constexpr: semantic checking for constexpr variables.We had an extension which allowed const static class members of floating-point type to have in-class initializers, 'as a C++0x extension'. Howev
constexpr: semantic checking for constexpr variables.We had an extension which allowed const static class members of floating-point type to have in-class initializers, 'as a C++0x extension'. However, C++0x does not allow this. The extension has been kept, and extended to all literal types in C++0x mode (with a fixit to add the 'constexpr' specifier).llvm-svn: 140801
Diagnose the presence of multiple initializations of static datamembers, from Faisal Vali! Fixes PR6904.llvm-svn: 111900