[Bug c++/78022] constexpr int template rejected unless constructor is used before hand

fiesh at zefix dot tv gcc-bugzilla@gcc.gnu.org
Tue Jan 30 12:27:00 GMT 2018


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

--- Comment #3 from fiesh at zefix dot tv ---
Interestingly, clang-5 no longer compiles this code:

<source>:28:15: error: constexpr variable 'b1' must be initialized by a
constant expression
                constexpr B b1{0};
                            ^~~~~
<source>:28:15: note: constructor inherited from base class 'A<int>' cannot be
used in a constant expression; derived class cannot be implicitly initialized
<source>:14:16: note: declared here
        using A<int>::A;
                      ^
1 error generated.
Compiler returned: 1

So gcc, clang <=4 and clang-5 behave pairwise differently.  At most one of them
can be right, who might it be?


More information about the Gcc-bugs mailing list