What should be called? [was: BOOST_CHECK_EQUAL fails...]

Sorry for the repost, but there was no answer to this (http://tinyurl.com/3yba8) and I'm still not sure if it is a compiler or a boost defect. Which f should be called here? void f(const char*) { std::cout << "function called!" << std::endl; } template <typename T> void f(const T&) { std::cout << "function template called!" << std::endl; } int main() { char buf[10] = { 0 }; f(buf); } In my opinion, it should be the function template (which whould also mean that EDG works correctly and VC 7.1 not) as "f(char[10])" is no exact match for the function. However, this would also mean that there is a defect in boost.test (see link above). br, Stefan *********************************** Stefan Slapeta Wien/Vienna, Austria http://www.slapeta.com

"Stefan Slapeta" <stefan_nospam_@slapeta.com> wrote in message news:c469ba$ggf$1@sea.gmane.org...
[...] Which f should be called here? [...]
If I recall correctly, normal functions are always considered before template functions during overload resolution. I guess the question is whether const char* == char[10] for the purposes of overload resolution. I think it does, so I believe the first one should be called. Unfortunately, I don't have my copy of C++ Templates handy, so I can't look it up. Dave --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004
participants (2)
-
David B. Held
-
Stefan Slapeta