<div dir="ltr"><div style>Hello cfe-dev!</div><div style><br></div><div style>+Richard Smith</div><div style><br></div><div style>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.</div>

<div style>Here is an example:</div><div style><br></div><div>void __attribute__((noreturn)) func(int i) {}</div><div><br></div><div>template <typename T></div><div>void __attribute__((noreturn)) tfunc(T t) {}</div>

<div><br></div><div>typedef void (*ptr)(int);</div><div><br></div><div>void foo(ptr p) {}</div><div><br></div><div>void bar() {</div><div>  foo(func); // Okay</div><div>  foo(tfunc<int>); // Error: ... candidate function 'foo' not viable</div>

<div>}</div><div><br></div><div>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.<br>

</div><div><br></div><div style>One would expect consistent behavior in this case, though.</div><div style>Should I file a bug for it?</div></div>