Commit d8d58893 by Paolo Carlini Committed by Paolo Carlini

re PR c++/69637 (ICE on an invalid bit-field with template name for width)

/cp
2017-02-02  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/69637
	* decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
	to the width.

/testsuite
2017-02-02  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/69637
	* g++.dg/cpp0x/pr69637-1.C: New.
	* g++.dg/cpp0x/pr69637-2.C: Likewise.

From-SVN: r245117
parent 521a70a4
2017-02-02 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/69637
* decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL
to the width.
2017-01-31 Jakub Jelinek <jakub@redhat.com> 2017-01-31 Jakub Jelinek <jakub@redhat.com>
PR c++/79304 PR c++/79304
......
...@@ -1059,8 +1059,11 @@ grokbitfield (const cp_declarator *declarator, ...@@ -1059,8 +1059,11 @@ grokbitfield (const cp_declarator *declarator,
&& !INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (width))) && !INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (width)))
error ("width of bit-field %qD has non-integral type %qT", value, error ("width of bit-field %qD has non-integral type %qT", value,
TREE_TYPE (width)); TREE_TYPE (width));
DECL_INITIAL (value) = width; else
SET_DECL_C_BIT_FIELD (value); {
DECL_INITIAL (value) = width;
SET_DECL_C_BIT_FIELD (value);
}
} }
DECL_IN_AGGR_P (value) = 1; DECL_IN_AGGR_P (value) = 1;
......
2017-02-02 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/69637
* g++.dg/cpp0x/pr69637-1.C: New.
* g++.dg/cpp0x/pr69637-2.C: Likewise.
2017-02-02 Andreas Krebbel <krebbel@linux.vnet.ibm.com> 2017-02-02 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* gcc.target/s390/s390.exp: Rename __S390_VX__ to __VX__. * gcc.target/s390/s390.exp: Rename __S390_VX__ to __VX__.
......
// { dg-do compile { target c++11 } }
template <class T>
int foo () { return 1; }
struct B {
unsigned c: foo; // { dg-error "non-integral type" }
};
// { dg-do compile { target c++11 } }
template <class T, int N>
constexpr int foo () { return N; }
struct B { unsigned c: foo<int>, 3(); }; // { dg-error "non-integral type|expected" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment