[Bug c++/64842] Implicitly defined constructor isn't constexpr

simendsjo at simendsjo dot me gcc-bugzilla@gcc.gnu.org
Wed Feb 25 09:52:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64842

--- Comment #2 from simendsjo at simendsjo dot me ---
(In reply to Ville Voutilainen from comment #1)
> The constructors for Point are constexpr, but since p2 is not, passing
> it as an argument for scale() means that the invocation of scale() will not
> yield a constant expression. If you change the declaration of p2 to
> be
> constexpr Point p2 {10,10};
> the code will work. Clang agrees with gcc.

Then there are a couple of possibilities:
1. The spec is wrong
2. Bjarne Stroustrup misinterprets the spec
3. gcc and clang has the same bug

You're saying that 2. holds. In that case, send a mail to Stroustrup so he can
correct his book "Programming: Principles and Practice using C++".



More information about the Gcc-bugs mailing list