[cfe-dev] When does ~decltype(expr) make sense ?
    Manasij Mukherjee 
    manasij7479 at gmail.com
       
    Sun Feb 22 07:56:53 PST 2015
    
    
  
Hi,
I am trying to fix this bug,
http://llvm.org/bugs/show_bug.cgi?id=22508
In short,
struct A
{
    ~decltype(auto){}
};
is accepted when it should not be.
In Parser::ParseUnqualifiedId (ParseExprCXX.cpp:2488 ),
// Parse the '~'.
    SourceLocation TildeLoc = ConsumeToken();
    if (SS.isEmpty() && Tok.is(tok::kw_decltype)) {
      DeclSpec DS(AttrFactory);
      SourceLocation EndLoc = ParseDecltypeSpecifier(DS);
      if (ParsedType Type = Actions.getDestructorType(DS, ObjectType)) {
        Result.setDestructorName(TildeLoc, Type, EndLoc);
        return false;
      }
      return true;
    }
After this, clang handles the identifier case.
Removing this block results in clang reporting the correct diagnostic:
"error: expected a class name after '~' to name a destructor"
Why is this block present ?
Can anyone point out what is the expected behavior ?
Thanks
Manasij Mukherjee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150222/a119a403/attachment.html>
    
    
More information about the cfe-dev
mailing list