diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-10-23 03:58:34 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-10-23 03:58:34 +0000 |
commit | 8910fe699e88f57eac891b5075659e6eb2cfdee2 (patch) | |
tree | 33f5c6a9f3e6b180bd89b87a6cdee56405bc71a8 /clang/test/CodeGenCXX/cxx1z-inline-variables.cpp | |
parent | 64cb997ce18ad000a9ced4f49744aa385deef730 (diff) | |
download | bcm5719-llvm-8910fe699e88f57eac891b5075659e6eb2cfdee2.tar.gz bcm5719-llvm-8910fe699e88f57eac891b5075659e6eb2cfdee2.zip |
For better compatibility with C++11 and C++14, emit a nondiscardable definition
of a static constexpr data member if it's defined 'constexpr' out of line, not
only if it's defined 'constexpr' in the class.
llvm-svn: 316310
Diffstat (limited to 'clang/test/CodeGenCXX/cxx1z-inline-variables.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/cxx1z-inline-variables.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/clang/test/CodeGenCXX/cxx1z-inline-variables.cpp b/clang/test/CodeGenCXX/cxx1z-inline-variables.cpp index 183709373d1..0d2ec92a7af 100644 --- a/clang/test/CodeGenCXX/cxx1z-inline-variables.cpp +++ b/clang/test/CodeGenCXX/cxx1z-inline-variables.cpp @@ -31,18 +31,28 @@ struct compat { static constexpr int b = 2; static constexpr int c = 3; static inline constexpr int d = 4; + static const int e = 5; + static const int f = 6; + static const int g = 7; }; const int &compat_use_before_redecl = compat::b; const int compat::a; const int compat::b; const int compat::c; const int compat::d; +const int compat::e; +constexpr int compat::f; +constexpr inline int compat::g; const int &compat_use_after_redecl1 = compat::c; const int &compat_use_after_redecl2 = compat::d; -// CHECK: @_ZN6compat1bE = weak_odr constant i32 2 -// CHECK: @_ZN6compat1aE = weak_odr constant i32 1 -// CHECK: @_ZN6compat1cE = weak_odr constant i32 3 -// CHECK: @_ZN6compat1dE = linkonce_odr constant i32 4 +const int &compat_use_after_redecl3 = compat::g; +// CHECK-DAG: @_ZN6compat1bE = weak_odr constant i32 2 +// CHECK-DAG: @_ZN6compat1aE = weak_odr constant i32 1 +// CHECK-DAG: @_ZN6compat1cE = weak_odr constant i32 3 +// CHECK-DAG: @_ZN6compat1dE = linkonce_odr constant i32 4 +// CHECK-DAG: @_ZN6compat1eE = constant i32 5 +// CHECK-DAG: @_ZN6compat1fE = weak_odr constant i32 6 +// CHECK-DAG: @_ZN6compat1gE = linkonce_odr constant i32 7 template<typename T> struct X { static int a; |