Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct A { };
- template <int>
- struct Parent { };
- template <int N>
- constexpr int operator*(A, Parent<N>*) { return N; }
- template <class T>
- using ptr = T*;
- template <int>
- struct Other { };
- template <int N>
- struct Kid: Parent<N> {
- static Other<A{} * ptr<Kid>{}> o;
- };
- int main() {
- Kid<2>{};
- }
- prog.cc:7:15: note: candidate template ignored: could not match 'Parent' against 'Kid'
- constexpr int operator*(A, Parent<N>*) { return N; }
- struct A { };
- template <int>
- struct Parent { };
- template <int N>
- constexpr int operator*(A, Parent<N>*) { return N; }
- template <class T>
- using ptr = T*;
- template <int>
- struct Other { };
- template <int N>
- struct Kid: Parent<N> {
- static constexpr int s = A{} * ptr<Kid>{};
- };
- int main() {
- Other<Kid<2>::s>{};
- }
Add Comment
Please, Sign In to add comment