template<template<typename, size_t>class V, typename, size_t N>
struct X{
static constexpr size_t stride = N;
};
template<typename Num, size_t N>
struct Y;
template<typename Num>
struct Y<Num, 3> : protected X<Y, Num, 3>{
using X<Y, Num, 3>::stride;
Y<Num, stride> foo(Num angle, Y<Num, stride> axis) const;
};
I try to provide a definition for foo
like:
1.
template<typename Num>
Y<Num, 3> Y<Num, 3>::foo(Num angle, Y<Num, 3> axis) const{};
template<typename Num>
Y<Num, Y<Num, 3>::stride> Y<Num, 3>::foo(Num angle, Y<Num, Y<Num, 3>::stride> axis) const{};
template<typename Num>
Y<Num, X<Y, Num, 3>::stride> Y<Num, 3>::foo(Num angle, Y<Num, X<Y, Num, 3>::stride> axis) const{};
but none of them is accepted by compilers (clang, msvc, and gcc 7.5-). (why gcc 8.1+ works?)
but if I define stride
at Y
like static constexpr size_t stride = X<Y, Num, 3>::stride
, 1 and 2 work.
or if X
is not a class template, they work as well.
what's the reason? a mistake declared by standard or just a compiler bug? and how to work at the using X::stride
situation?
code: https://godbolt.org/z/asn8rj.
Aucun commentaire:
Enregistrer un commentaire