re PR c++/53594 ([C++11] Spurious -Wuninitialized warning for member with NSDMI)

PR c++/53594
	* class.c (check_bases_and_members): Avoid -Wuninitialized
	diagnostics for non-static const members or references if they
	use NSDMI.

	* g++.dg/cpp0x/nsdmi7.C: New test.

From-SVN: r188926
This commit is contained in:
Jakub Jelinek 2012-06-25 08:54:08 +02:00 committed by Jakub Jelinek
parent 139c07de92
commit 2277d6b327
4 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2012-06-25 Jakub Jelinek <jakub@redhat.com>
PR c++/53594
* class.c (check_bases_and_members): Avoid -Wuninitialized
diagnostics for non-static const members or references if they
use NSDMI.
2012-06-19 Jason Merrill <jason@redhat.com>
PR c++/53651

View File

@ -5063,7 +5063,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);

View File

@ -1,3 +1,8 @@
2012-06-25 Jakub Jelinek <jakub@redhat.com>
PR c++/53594
* g++.dg/cpp0x/nsdmi7.C: New test.
2012-06-22 Tobias Burnus <burnus@net-b.de>
Backport from mainline

View File

@ -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;
};