]> granicus.if.org Git - clang/commit
For variables with dependent type, don't crash on `var->::new` or `var->__super`
authorNico Weber <nicolasweber@gmx.de>
Mon, 16 Feb 2015 22:32:46 +0000 (22:32 +0000)
committerNico Weber <nicolasweber@gmx.de>
Mon, 16 Feb 2015 22:32:46 +0000 (22:32 +0000)
commitfffe56ebdc121f2666d46663ee106dd2a576db27
treede92affacd2609c2f11763bed03f23e0fa1d1e4b
parentac03901885ef7bc902fc888a2ca3dd86281e56bf
For variables with dependent type, don't crash on `var->::new` or `var->__super`

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
lib/Parse/ParseExprCXX.cpp
test/SemaCXX/MicrosoftSuper.cpp
test/SemaCXX/new-delete.cpp