I need access to a static constexpr
and one solution I put together works with gcc (live example) but not with vc++ (live example).
The code is as follows:
template<class Drvd>
class Base
{
public:
static constexpr bool val = Drvd::val;
};
class Derived : public Base<Derived>
{
friend class Base;
private:
static constexpr bool val = true;
};
int main()
{
std::cout << Derived::Base::val << std::endl;
}
So it is a bug with vc++, but anyone has an idea on how to achieve val
defined in Base
as the value of val
in Drvd
in a different way that vc++ won't complain about?
Edit:
Note that the result is the same with the variant: friend class Base<Derived>;
instead of friend class Base;