<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">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><br></div><div>Thanks<br></div><div>Manasij Mukherjee<br></div><div><div><div><br></div></div></div></div>