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

2020-08-17 Thread fiesh at zefix dot tv
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78022

fiesh at zefix dot tv changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from fiesh at zefix dot tv ---
I'll close this since it now compiles fine.

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

2018-12-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78022

--- Comment #7 from Marek Polacek  ---
Or, let's say, started to be accepted.

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

2018-12-06 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78022

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #6 from Marek Polacek  ---
That was fixed by r261084.

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

2018-12-06 Thread fiesh at zefix dot tv
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78022

--- Comment #5 from fiesh at zefix dot tv ---
The code still does not compile with gcc-8.2 but does compile on trunk now!

Conversely, clang consistently refuses to compile it since clang-5.

So I guess this can be closed, unless clang is actually correct and my bug
report was flawed because the code is actually invalid?

For what it's worth, godbolt shows that both MSVC and ICC accept the code as
valid.

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

2018-02-12 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78022

Jonathan Wakely  changed:

   What|Removed |Added

   Last reconfirmed|2016-10-19 00:00:00 |2018-2-12
  Known to fail||8.0

--- Comment #4 from Jonathan Wakely  ---
Still fails on trunk (and Clang-5+ as reported). Clang-4 and EDG 4.14 accept
it.

Slightly reduced:

template
struct A
{
template
constexpr A(Args&&...){}
};

struct B : public A
{
using A::A;
};

// Uncommenting the following line makes this file compile.
//constexpr B p{0};
// Commenting the following line makes this file compile.
template
struct X
{
X()
{
// The following line is fine.
const B b0{0};
// The following line produces an error.
constexpr B b1{0};
}
};

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

2018-01-30 Thread fiesh at zefix dot tv
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:

:28:15: error: constexpr variable 'b1' must be initialized by a
constant expression
constexpr B b1{0};
^
:28:15: note: constructor inherited from base class 'A' cannot be
used in a constant expression; derived class cannot be implicitly initialized
:14:16: note: declared here
using A::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?

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

2016-10-18 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78022

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||rejects-valid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-10-19
Summary|Strange C++ compilation |constexpr int template
   |error   |rejected unless constructor
   ||is used before hand
 Ever confirmed|0   |1
  Known to fail||5.3.0, 5.4.0, 7.0

--- Comment #2 from Andrew Pinski  ---
Confirmed.
struct X can be a function too.