@@ -1460,7 +1460,10 @@ cp_omp_mappable_type_1 (tree type, bool notes)
{
tree field;
for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
- if (VAR_P (field))
+ if (VAR_P (field)
+ /* Fields that are 'static constexpr' can be folded away at compile
+ time, thus does not interfere with mapping. */
+ && !DECL_DECLARED_CONSTEXPR_P (field))
{
if (notes)
inform (DECL_SOURCE_LOCATION (field),
new file mode 100644
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-require-effective-target c++11 }
+
+/* Test that static constexpr members do not interfere with offloading. */
+struct rec
+{
+ static constexpr int x = 1;
+ int y, z;
+};
+
+void foo (rec& r)
+{
+ #pragma acc parallel copy(r)
+ {
+ r.y = r.y = r.x;
+ }
+}
new file mode 100644
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-require-effective-target c++11 }
+
+/* Test that static constexpr members do not interfere with offloading. */
+struct rec
+{
+ static constexpr int x = 1;
+ int y, z;
+};
+
+void foo (rec& r)
+{
+ #pragma omp target map(r)
+ {
+ r.y = r.y = r.x;
+ }
+}