[cfe-dev] Template matching question

Richard Smith richard at metafoo.co.uk
Thu Feb 20 13:58:32 PST 2014


On Thu, Feb 20, 2014 at 12:43 PM, Michael Steinberg <
michael.steinberg at tu-clausthal.de> wrote:

>  Hrmmm,
> thank you very much for verifying, and many excuses for the bother then.
> The error must be elsewhere then. Do you get a "noreturn" attribute
> decoration for the type of the function pointer btw?
>

No. We don't deduce a 'noreturn' attribute from the function definition,
and I don't think we ever did. If you're seeing one somewhere, I expect
your code is adding it itself.


> Just for the context, the error message given that I try to reason about
> (I don't have clang myself) is
>
> >>>>>>>>>>>>>>>>>>>>>
>
> In file included from ../test/test_exception_handlers.cpp:7:
> In file included from ../luabind/luabind.hpp:27:
> In file included from ../luabind/class.hpp:89:
> ../luabind/function.hpp:28:43: error: no matching function for call to 'deduce_signature'
>           object fn = make_function(L, f, deduce_signature(f), policies);
>                                           ^~~~~~~~~~~~~~~~
> ../luabind/function.hpp:48:13: note: in instantiation of member function 'luabind::detail::function_registration<void (*)() __attribute__((noreturn)), luabind::detail::null_type>::register_' requested here
>         new detail::function_registration<F, Policies>(name, f, policies)));
>             ^
> ../luabind/function.hpp:54:12: note: in instantiation of function template specialization 'luabind::def<void (*)() __attribute__((noreturn)), luabind::detail::null_type>' requested here
>     return def(name, f, detail::null_type());
>            ^
> ../test/test_exception_handlers.cpp:50:9: note: in instantiation of function template specialization 'luabind::def<void (*)() __attribute__((noreturn))>' requested here
>         def("raise", &raise_my_exception),
>
> Can you show us the declaration (preferably after preprocessing) of
raise_my_exception? (Also maybe of luabind::def.)

>
>         ^
> ../luabind/detail/deduce_signature.hpp:47:5: note: candidate template ignored: disabled by 'enable_if' [with F = void (*)() __attribute__((noreturn))]
>     is_function<F>,
>     ^
> ../luabind/detail/deduce_signature.hpp:60:1: note: candidate function template not viable: requires 2 arguments, but 1 was provided
> deduce_signature(F, Wrapped*)
>
> >>>>>>>>>>>>>>>>>>>>>>
>
> I hope you don't see garbage due to html there.
> The "deduce_signature" function indicated there has exactly the same
> signature as the one I gave in my OP-sample and the F-Type is a pointer to
> void-function which always throws. It should normally match, but apparently
> on clang 3.2 (in that very specific environment) it doesn't. That
> __attribute((noreturn))__ looked suspicious to me, but maybe it's something
> with the is_function template. I will investigate further, what might go
> wrong there.
>
> Thank you again!
>
> Michael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140220/e8672f25/attachment.html>


More information about the cfe-dev mailing list