[aspectc-user] Problem with template function declaration

Jens Schedel jens at schedel.org
Fri Jul 2 16:11:22 CEST 2010


Hi,

i have an problem with the following piece of code:

================================================================================
template<typename T> T stoc(T value);

template<typename T>
    T stoc(T value) {
    return value;
}

int main () {
    int bla=0xa;
    return stoc(bla);
}
================================================================================

==Compiler error================================================================
stoc.cpp:10: error: call to function `stoc (int)' is ambiguous
stoc.cpp:4: candidates are: T stoc(T) [with T = int]
stoc.cpp:1:                 T stoc(T) [with T = int]
================================================================================

It looks like the compiler makes no difference between the declaration
and the implementation of template function.
Commenting out the declaration fixes the problem :).

Regards,
Jens

PS: Thanks for the last quick bug fix.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3230 bytes
Desc: not available
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20100702/eb178de9/attachment.bin>


More information about the aspectc-user mailing list