This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70543] [6 Regression] wrong non-const error for enable_if and constexpr function
- From: "olegendo at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 05 Apr 2016 08:56:36 +0000
- Subject: [Bug c++/70543] [6 Regression] wrong non-const error for enable_if and constexpr function
- Auto-submitted: auto-generated
- References: <bug-70543-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70543
--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> ---
A slightly reduced version:
#include <type_traits>
template <typename Tuple> struct X
{
template <unsigned int I = 0> static constexpr
typename std::enable_if< I == 5, unsigned int>::type
calc (void)
{
return 0;
}
template <unsigned int I = 0> static constexpr
typename std::enable_if< I != 5, unsigned int>::type
calc (void)
{
return 1 + calc<I + 1> ();
}
static constexpr unsigned int value = calc (); // <<<<<<<
char foo[value];
};
If the marked line is changed to
static constexpr unsigned int value = calc<0> ();
it compiles fine.