summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated13.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated13.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated13.C19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated13.C b/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated13.C
new file mode 100644
index 00000000000..4a8af29b086
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp2a/is-constant-evaluated13.C
@@ -0,0 +1,19 @@
+// PR c++/105233
+// { dg-do compile { target c++14 } }
+
+template <typename T>
+constexpr T
+foo (T x) noexcept
+{
+ bool a = __builtin_is_constant_evaluated ();
+ T b = 4 * alignof (int);
+ return x < b ? b : x;
+}
+
+template <typename T>
+struct A { T a, b, c; };
+
+template <typename T>
+struct alignas (foo (sizeof (A<T>))) B { A<T> d; };
+
+B<int> e;