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: [PATCH] Fix c++/67371 (issues with throw in constexpr)


On 08/28/2015 08:00 AM, Markus Trippelsdorf wrote:
As PR67371 shows gcc currently rejects all throw statements in
constant-expressions, even when they are never executed.

Fix by simply allowing THROW_EXPR in potential_constant_expression_1.

One drawback is that we now accept some ill formed cases, but they
fall under the "no diagnostic required" rule in the standard, e.g.:

I think we can do better.

The handling of IF_STMT in potential_constant_expression_1 currently returns false if either the then or the else clauses are problematic, but instead it should return true if either of them are OK (or empty).

We could try to analyze the body of a SWITCH_STMT more closely, but if you don't want to try it's fine if we just assume that the body is OK.

Jason


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