Re: [C++0x patch] constexpr in attribute argument
Applied on trunk. Jason
Re: [C++0x patch] constexpr in attribute argument
On Fri, Mar 11, 2011 at 4:58 PM, Jason Merrill wrote: > Sure, I guess calling it in one place is better. But I think let's wait > until 4.6.1 for this patch. Oh, I didn't notice the only-regression-fixes status. No problem. -- Rodrigo.
Re: [C++0x patch] constexpr in attribute argument
On 03/11/2011 04:33 AM, Rodrigo Rivas wrote: On Fri, Mar 11, 2011 at 6:51 AM, Jason Merrill 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: Ah, yes, you would also need to call it in apply_late_template_attributes. BTW, a general question, why isn't there a call to maybe_constant_value just at the end of fold_non_dependent_expr? I tried combining the two functions at one point but it didn't work so well. It might make sense to try again, though. The problem is that we don't want to call fold_non_dependent_expr on an expression that has already been folded, but it's fine to repeat maybe_constant_value. My patch calls maybe_constant_value after taking away any dependent expression (cplus_decl_attributes does all the job). Sure, I guess calling it in one place is better. But I think let's wait until 4.6.1 for this patch. Jason
Re: [C++0x patch] constexpr in attribute argument
On Fri, Mar 11, 2011 at 6:51 AM, Jason Merrill 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: .../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
Re: [C++0x patch] constexpr in attribute argument
How about just calling maybe_constant_value call after the fold_non_dependent_expr call in cp_parser_parenthesized_expression_list? Jason