[ConceptGCC] |
ConceptGCC :Re: Addable |
From: Jaakko Jarvi (jarvi_at_[hidden])
Date: 2007-03-07 18:21:09
Yes, it is normal behavior.
The operator+(foo, foo) is only in scope constrained with Addable<foo>.
The following should work (assuming your concept_map Addable<foo>):
template <Addable T>
void bar(T t) { t + t; }
bar(foo);
Cheers,
Jaakko Järvi
On Mar 7, 2007, at 3:37 PM, Karl Meerbergen wrote:
> Hi,
>
> The following piece of code compiled with the current SVN version
> produces a compilation error. Is this normal behaviour?
>
> Thanks,
>
> Karl
>
>
>
> #include <concepts>
>
> struct foo {} ;
>
> namespace std {
>
> concept_map Addable< foo > {
> foo operator+( foo const& f, foo const& b ) {
> return f ;
> }
> }
> }
>
> int main() {
> foo f, b ;
>
> f + b ;
> }
>
>
> p.cpp: In function 'int main()':
> p.cpp:17: error: no match for 'operator+' in 'f + b'
>
> <Karl.Meerbergen.vcf>
> _______________________________________________
> ConceptGCC mailing list
> ConceptGCC_at_[hidden]
> http://www.osl.iu.edu/mailman/listinfo.cgi/conceptgcc