void C<T>::opB( bool f )
requires is_same<T, B>::value
pt->op( f );
MSVC will instantiate opA for A as well as B and opB
also for A as well as B and gives the following errors:
(42,10): error : too many arguments to function call, expected 0, have 1 (46,8): message : in instantiation of member function 'C<A>::opB'
(7,7): message : 'op' declared here
(34,9): error : too few arguments to function call, expected 1, have 0
(49,8): message : in instantiation of member function 'C<B>::opA'
(12,7): message : 'op' declared here
clang gives similar errors, but g++12 is smarter and skips inappropriate compilation, i.e. filters the functions through their concepts, i.e. it compiles opA only for A and opB only for B - so which compiler is right
here ? And is there a workaround ?
From Bonita Montero@21:1/5 to All on Sun Sep 19 18:03:04 2021
I wrote the same thing on Stack Overflow. C<A>::opB( bool )
and C<B>::opA() shouldn't be instantiated according to the
standard. So this is a bug of clang. MSVC has fixed the bug
in the latest release.