<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Feb 22, 2015 at 7:56 AM, Manasij Mukherjee <span dir="ltr"><<a href="mailto:manasij7479@gmail.com" target="_blank">manasij7479@gmail.com</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 dir="ltr"><div><div><div><div><div><div><div>Hi,<br></div>I am trying to fix this bug,<br><a href="http://llvm.org/bugs/show_bug.cgi?id=22508" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=22508</a><br><br></div>In short, <br>struct A <br>{ <br>    ~decltype(auto){} <br>};<br></div>is accepted when it should not be.<br><br></div>In Parser::ParseUnqualifiedId (ParseExprCXX.cpp:2488 ), <br><br>// Parse the '~'.<br>    SourceLocation TildeLoc = ConsumeToken();<br><br>    if (SS.isEmpty() && Tok.is(tok::kw_decltype)) {<br>      DeclSpec DS(AttrFactory);<br>      SourceLocation EndLoc = ParseDecltypeSpecifier(DS);<br>      if (ParsedType Type = Actions.getDestructorType(DS, ObjectType)) {<br>        Result.setDestructorName(TildeLoc, Type, EndLoc);<br>        return false;<br>      }<br>      return true;<br>    }<br><br></div><div>After this, clang handles the identifier case.<br><br></div><div>Removing this block results in clang reporting the correct diagnostic:<br>"error: expected a class name after '~' to name a destructor"<br><br>Why is this block present ?<br></div></div>Can anyone point out what is the expected behavior ?<br></div></div></blockquote><div><br>5.1.1 [expr.prim.general] in paragraph 8 states that "The form ~ decltype-specifier also denotes the destructor, but it shall not be used as
the unqualified-id in a qualified-id."<br><br>I implemented this a while ago, but it looks like (r146155) it was for expressions (x.~decltype(*x)(), for example) not necessarily for dtor declarations.<br><br>I can't find any particular words in the spec about taht, but I could believe it's not intended (I didn't test it, at least) for dtor declarations/definitions to use this syntax.<br><br><a href="http://llvm.org/bugs/show_bug.cgi?id=15801">http://llvm.org/bugs/show_bug.cgi?id=15801</a> was also filed about this<br> </div><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 dir="ltr"><div><br></div><div>Thanks<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div>Manasij Mukherjee<br></div><div><div><div><br></div></div></div></font></span></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>