@@ -5122,7 +5122,8 @@ check_bases_and_members (tree t)
{
tree type;
- if (TREE_CODE (field) != FIELD_DECL)
+ if (TREE_CODE (field) != FIELD_DECL
+ || DECL_INITIAL (field) != NULL_TREE)
continue;
type = TREE_TYPE (field);
@@ -0,0 +1,17 @@
+// PR c++/53594
+// { dg-do compile }
+// { dg-options "-std=c++11 -Wuninitialized" }
+
+struct A
+{
+ const int a = 6; // { dg-bogus "non-static const member" }
+ static int b;
+ int &c = b; // { dg-bogus "non-static reference" }
+};
+
+struct B
+{
+ const int d; // { dg-warning "non-static const member" }
+ int &e; // { dg-warning "non-static reference" }
+ int f = 7;
+};