================ @@ -0,0 +1,87 @@ +// RUN: %clangxx -target arm64-apple-macosx11.0.0 -g %s -emit-llvm -S -o - | FileCheck --check-prefixes=CHECK %s + +enum class Enum : int { + VAL = -1 +}; + +struct Empty {}; + +constexpr auto func() { return 25; } + +struct Foo { + static constexpr int cexpr_int = func(); + static constexpr int cexpr_int2 = func() + 1; + static constexpr float cexpr_float = 2.0 + 1.0; + static constexpr Enum cexpr_enum = Enum::VAL; + static constexpr Empty cexpr_empty{}; + static inline Enum inline_enum = Enum::VAL; + + template<typename T> + static constexpr T cexpr_template{}; +}; + +int main() { + Foo f; + + // Force global variable definitions to be emitted. + (void)&Foo::cexpr_int; + (void)&Foo::cexpr_empty; + + return Foo::cexpr_int + Foo::cexpr_float + + (int)Foo::cexpr_enum + Foo::cexpr_template<short>; +} + +// CHECK: @{{.*}}cexpr_int{{.*}} = +// CHECK-SAME: !dbg ![[INT_GLOBAL:[0-9]+]] + +// CHECK: @{{.*}}cexpr_empty{{.*}} = +// CHECK-SAME !dbg ![[EMPTY_GLOBAL:[0-9]+]] + +// CHECK: !DIGlobalVariableExpression(var: ![[INT_VAR:[0-9]+]], expr: !DIExpression()) ---------------- dwblaikie wrote:
Why doesn't this have a value/expression? (but INT_VAR2 does) https://github.com/llvm/llvm-project/pull/70639 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits