Paolo Carlini
2014-10-06 08:56:55 UTC
Hi,
the second half of the bug report is about C++14 variable declarations
in constexpr functions, an implementation request which should be
already done by Jason's recent commit.
The first half is about us not rejecting in C++11 mode type declarations
in constexpr functions outside, per 7.1.5/3/4:
"typedef declarations and alias-declarations that do not define
classes or enumerations,"
In fact, however, while working on the issue, I noticed that conversely
we reject *all* type declarations in constructors (actually we used to
ICE on those, which a while ago I turned to reject valid), eg:
struct S
{
constexpr S() { typedef int T; }
};
Thus I prepared the below, which in C++11 mode checks the exact
requirements above, both for constructors and all the other functions. I
had to add handling of BIND_EXPRs to the main conditional of
build_constexpr_constructor_member_initializers, otherwise we ICE
immediately on something as simple as the snippet above: I think all is
fine because we get to the conditional having checked the BIND_EXPR_VARS
part with the new checking function. Tested x86_64-linux.
Thanks!
Paolo.
/////////////////////
the second half of the bug report is about C++14 variable declarations
in constexpr functions, an implementation request which should be
already done by Jason's recent commit.
The first half is about us not rejecting in C++11 mode type declarations
in constexpr functions outside, per 7.1.5/3/4:
"typedef declarations and alias-declarations that do not define
classes or enumerations,"
In fact, however, while working on the issue, I noticed that conversely
we reject *all* type declarations in constructors (actually we used to
ICE on those, which a while ago I turned to reject valid), eg:
struct S
{
constexpr S() { typedef int T; }
};
Thus I prepared the below, which in C++11 mode checks the exact
requirements above, both for constructors and all the other functions. I
had to add handling of BIND_EXPRs to the main conditional of
build_constexpr_constructor_member_initializers, otherwise we ICE
immediately on something as simple as the snippet above: I think all is
fine because we get to the conditional having checked the BIND_EXPR_VARS
part with the new checking function. Tested x86_64-linux.
Thanks!
Paolo.
/////////////////////