<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Jan 28, 2014, at 4:52 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br><div><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jan 28, 2014 at 10:34 AM, <span dir="ltr"><<a href="mailto:bugzilla-daemon@llvm.org" target="_blank">bugzilla-daemon@llvm.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div>
<br class="webkit-block-placeholder"></div><div>
<b><a title="NEW --- - "noreturn" follows virtual method implementation (opposite of g++)" href="http://llvm.org/bugs/show_bug.cgi?id=12200#c12" target="_blank">Comment # 12</a>
on <a title="NEW --- - "noreturn" follows virtual method implementation (opposite of g++)" href="http://llvm.org/bugs/show_bug.cgi?id=12200" target="_blank">bug 12200</a>
from <span><a href="mailto:rjmccall@apple.com" title="John McCall <rjmccall@apple.com>" target="_blank"> <span>John McCall</span></a>
</span></b>
<pre>(In reply to <a href="http://llvm.org/bugs/show_bug.cgi?id=12200#c10" target="_blank">comment #10</a>)
<span>> There's also an IRgen problem: it should ignore 'noreturn' when making a
> (non-devirtualized) virtual call -- that's a property of the function, not
> of the vtable slot.</span>
That's the GCC model. Our design has always been that attribute((noreturn))
--- when declared in the class definition --- is a property of the signature of
the virtual function.</pre></div></div></blockquote><div>[Moving this discussion to cfe-dev for visibility.]<br></div><div><br></div><div>This is a GCC attribute, so my first inclination is to say that GCC gets to define its semantics.</div></div></div></div></blockquote><div><br></div><div>Is there a specification for it that I’ve missed? My understanding is that this is accidental fallout from a particularly poor representation choice that prevents them from supporting noreturn on member functions at all, and that GCC would consider this a (perhaps low priority or even unfixable) bug in their implementation. Certainly our model is more consistent with the original philosophy behind making __attribute__((noreturn)) part of the function type. Our model is also more expressive: among other things, it makes it meaningful to put __attribute__((noreturn)) on a virtual function declaration (including a pure one), and it enables things like a member function that polymorphically throws its object as an exception. In contrast, overriding a noreturn virtual function with a returning implementation seems basically useless — what code could ever reasonably use it? — unless the overridden function is not meant to ever actually be called, and frankly there are much more appropriate tools for that pattern (like builtin_unreachable, or just making the base class abstract).</div><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Do we actually have a strong case for diverging from GCC here? We have evidence that we're breaking existing code and damaging our portability story by doing so. (FWIW, C++11's [[noreturn]] behaves like GNU's [[noreturn]], and our implementation of _Noreturn does the same. I don't know how __declspec(noreturn) behaves.)</div></div></div></div></blockquote></div><br><div>Analogies to [[noreturn]] and _Noreturn are flawed because they are defined by the standards to not be part of the type. If you want to argue that all of these attributes should be interchangeable, you’re really arguing for a fundamental change to the GCC extension.</div><div><br></div><div>John.</div></body></html>