[cfe-dev] Template matching question

Michael Steinberg michael.steinberg at tu-clausthal.de
Thu Feb 20 08:19:16 PST 2014


Hello,
there is an interesting (for me) problem with luabind that you might be
able to answer.

Considering the template:

template< typename T >
void deduce( T (*)(), ... ) {}

template< typename T >
void deduce( T f, SomeType g ) {}

...more overloads...

and the function:

void foo() {
   throw some();
}

deduce( foo );

clang 3.2 seems to add an implicit attribute "noreturn" (I assume that
is because clang detected the function will never return). This
attribute seems to rule out the given first overload of function
template "deduce", which would otherwise be responsible to match the
given function's signature and consequently fails on the second
overload. Is that legal? Or maybe the mismatch is caused by another reason?

Kind regards,
Michael



More information about the cfe-dev mailing list