[cfe-dev] Noreturn adjustment for template functions
Alexander Zinenko
ftynse at gmail.com
Sat Feb 16 05:18:39 PST 2013
Hello cfe-dev!
+Richard Smith
Investigating another issue, I found out that an instantiated noreturn
template function can't be implicitly used as not-noreturn argument while
non-template function can.
Here is an example:
void __attribute__((noreturn)) func(int i) {}
template <typename T>
void __attribute__((noreturn)) tfunc(T t) {}
typedef void (*ptr)(int);
void foo(ptr p) {}
void bar() {
foo(func); // Okay
foo(tfunc<int>); // Error: ... candidate function 'foo' not viable
}
It is most likely due to noreturn function representation (there was a
discussion on PR15105 lately). As far as I see, SemaOverload.cpp contains a
special case for noreturn adjustment as an implicit conversion, but it
doesn't account for templates.
One would expect consistent behavior in this case, though.
Should I file a bug for it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130216/5ea11bd1/attachment.html>
More information about the cfe-dev
mailing list