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]

Re: [C++0x patch] constexpr in attribute argument


On Fri, Mar 11, 2011 at 6:51 AM, Jason Merrill <jason@redhat.com> wrote:
> How about just calling maybe_constant_value call after the
> fold_non_dependent_expr call in cp_parser_parenthesized_expression_list?

Well, I first tried something like this, but the key problem is the
*non_dependent* part, so it does nothing if the expression involves
templates:

$ g++ -std=gnu++0x constexpr-attribute.C
.../constexpr-attribute.C: At global scope:
.../constexpr-attribute.C: In instantiation of S3<int>:
.../constexpr-attribute.C:63:9:   instantiated from here
.../constexpr-attribute.C:59:44: error: requested alignment is not a constant
 void fun() [with T = int]
.../constexpr-attribute.C:33:14:   instantiated from here
.../constexpr-attribute.C:24:7: error: requested alignment is not a constant
.../constexpr-attribute.C:25:7: error: requested alignment is not a constant

BTW, a general question, why isn't there a call to
maybe_constant_value just at the end of fold_non_dependent_expr?

My patch calls maybe_constant_value after taking away any dependent
expression (cplus_decl_attributes does all the job).

--
Rodrigo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]