You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
template<template<classT> class> structA {};
template<classT> structQ {};
template<classT> using R = Q<T>;
intf(A<R>);
intg(A<Q> a) { returnf(a); }
GCC accepts (since 4.9.0), Clang rejects with:
<source>:5:24: error: no matching function for call to 'f'int g(A<Q> a) { return f(a); } ^<source>:4:5: note: candidate function not viable: no known conversion from 'A<template Q>' to 'A<template R>' for 1st argumentint f(A<R>); ^
-frelaxed-template-template-args doesn't seem to help in any recent major.
The text was updated successfully, but these errors were encountered:
For anyone looking for a workaround, this is one of the ways that worked for me (assuming that Q does not have weird specializations, testing only for one, char):
#include<type_traits>template<template<classT> class> structA {};
template<classT> structQ {};
template<classT> using R = Q<T>;
template<template<class> classU>
intf(A<U>)
{
static_assert(std::is_same_v<U<char>,R<char>>);
return42;
}
intg(A<Q> a) { returnf(a); }
or a series of if constexprs if f needs to be "overloaded" for multiple Us.
Uh oh!
There was an error while loading. Please reload this page.
GCC accepts (since 4.9.0), Clang rejects with:
-frelaxed-template-template-args
doesn't seem to help in any recent major.The text was updated successfully, but these errors were encountered: