diff options
Diffstat (limited to 'Tests/CompileFeatures/cxx_relaxed_constexpr.cpp')
-rw-r--r-- | Tests/CompileFeatures/cxx_relaxed_constexpr.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp b/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp new file mode 100644 index 0000000..bce82e3 --- /dev/null +++ b/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp @@ -0,0 +1,23 @@ + +struct X { + constexpr X() : n(5) { + n *= 2; + } + int n; +}; + +constexpr int g(const int (&is)[4]) { + X x; + int r = x.n; + for (int i = 0; i < 5; ++i) + r += i; + for (auto& i : is) + r += i; + return r; +} + +int someFunc() +{ + constexpr int k3 = g({ 4, 5, 6, 7 }); + return k3 - 42; +} |