Skip to content
Snippets Groups Projects
  • Nico Weber's avatar
    fffe56eb
    For variables with dependent type, don't crash on `var->::new` or `var->__super` · fffe56eb
    Nico Weber authored
    ParsePostfixExpressionSuffix() for '->' (or '.') postfixes first calls
    ActOnStartCXXMemberReference() to inform sema that a member reference is about
    to start, and that function lets the parser know if sema thinks that the
    base expression's type could allow a pseudo destructor from a semantic point of
    view (for example, if the the base expression has a dependent type).
    
    ParsePostfixExpressionSuffix() then calls ParseOptionalCXXScopeSpecifier() and
    passes MayBePseudoDestructor on to that function, expecting the function to
    set it to false if a pseudo destructor is impossible from a syntactic point of
    view (due to a lack of '~' sigil).  However, ParseOptionalCXXScopeSpecifier()
    had early-outs for ::new and __super, so MayBePseudoDestructor stayed true,
    so we tried to parse a pseudo dtor, and then became confused since we couldn't
    find a '~'.  Move the snippet in ParseOptionalCXXScopeSpecifier() that sets
    MayBePseudoDestructor to false above the early exits.
    
    Parts of this found by SLi's bot.
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229449 91177308-0d34-0410-b5e6-96231b3b80d8
    fffe56eb
    History
    For variables with dependent type, don't crash on `var->::new` or `var->__super`
    Nico Weber authored
    ParsePostfixExpressionSuffix() for '->' (or '.') postfixes first calls
    ActOnStartCXXMemberReference() to inform sema that a member reference is about
    to start, and that function lets the parser know if sema thinks that the
    base expression's type could allow a pseudo destructor from a semantic point of
    view (for example, if the the base expression has a dependent type).
    
    ParsePostfixExpressionSuffix() then calls ParseOptionalCXXScopeSpecifier() and
    passes MayBePseudoDestructor on to that function, expecting the function to
    set it to false if a pseudo destructor is impossible from a syntactic point of
    view (due to a lack of '~' sigil).  However, ParseOptionalCXXScopeSpecifier()
    had early-outs for ::new and __super, so MayBePseudoDestructor stayed true,
    so we tried to parse a pseudo dtor, and then became confused since we couldn't
    find a '~'.  Move the snippet in ParseOptionalCXXScopeSpecifier() that sets
    MayBePseudoDestructor to false above the early exits.
    
    Parts of this found by SLi's bot.
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229449 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.