aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/class.cc3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr112365.C8
2 files changed, 10 insertions, 1 deletions
diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc
index 9d4d95f..4766b7c 100644
--- a/gcc/cp/class.cc
+++ b/gcc/cp/class.cc
@@ -6962,7 +6962,8 @@ layout_class_type (tree t, tree *virtuals_p)
check_bitfield_decl eventually sets DECL_SIZE (field)
to that width. */
&& (DECL_SIZE (field) == NULL_TREE
- || integer_zerop (DECL_SIZE (field))))
+ || integer_zerop (DECL_SIZE (field)))
+ && TREE_TYPE (field) != error_mark_node)
SET_DECL_FIELD_CXX_ZERO_WIDTH_BIT_FIELD (field, 1);
check_non_pod_aggregate (field);
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr112365.C b/gcc/testsuite/g++.dg/cpp0x/pr112365.C
new file mode 100644
index 0000000..23409cb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr112365.C
@@ -0,0 +1,8 @@
+// PR c++/112365
+// { dg-do compile { target c++11 } }
+// { dg-excess-errors "" }
+
+template <typename> struct A;
+template <typename T> A <T> foo (T;
+template <typename T> struct A { constexpr A : T {} }
+struct { bar ( { foo (this)