This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi!
The testcase below is rejected if array size is determined by const int
var with parenthesized initializer inside of a template, works if
it is initialized with = instead. [dcl.init]/8 says the two forms
should be generally equivalent except for classes.
cp_finish_decl says:
/* Generally, initializers in templates are expanded when the
template is instantiated. But, if DECL is an integral
constant static data member, then it can be used in future
integral constant expressions, and its value must be
available. */
The problem is that the array size checking is done when
processing_template_decl when the size isn't value dependent,
but can't handle TREE_LIST DECL_INITIAL. Below are two alternative
patches, the first one teaches integral_constant_value about it,
the second instead canonicalizes DECL_INITIAL at cp_finish_decl time
even when processing_template_decl for integral constant vars.
Both patches passed make check-g++. I'll do full bootstrap/regtest
on one of them if you pick one.
Jakub
Attachment:
Y101
Description: Text document
Attachment:
Y101a
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |