[llvm-bugs] [Bug 34507] New: Assertion failure (DelayedTypos.empty() && "Uncorrected typos!") in case of multiple typos in expression

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 6 09:21:10 PDT 2017


            Bug ID: 34507
           Summary: Assertion failure (DelayedTypos.empty() &&
                    "Uncorrected typos!") in case of multiple typos in
           Product: clang
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: oranevskyy at accesssoftek.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19115
  --> https://bugs.llvm.org/attachment.cgi?id=19115&action=edit

If a chain of member function calls has multiple typos in it clang -cc1 fails
with the assertion failure if built with assertion enabled.

To reproduce compile the attached test case:
clang -cc1 typo.cpp

In the expression "z_obj.getY2().getM();" both getY2() and getM() calls are
mistyped. The initial AST for this expression:
  CallExpr 0xcda1b01428 '<dependent type>'
  `-CXXDependentScopeMemberExpr 0xcda1b013d0 '<dependent type>' lvalue .getM
    `-CallExpr 0xcda1b013a8 '<dependent type>'
      `-TypoExpr 0xcda1b01398 '<dependent type>' lvalue

The TypoExpr here stands for the getY2() call.

During typo resolution TransformCXXDependentScopeMemberExpr() detects that
getM() is also a typo and transforms the whole CXXDependentScopeMemberExpr into
a single TypoExpr. The resulting expression after the transformation looks like
  CallExpr 0xcda1b01768 '<dependent type>'
  `-TypoExpr 0xcda1b01758 '<dependent type>' lvalue

This newly created TypoExpr does not get into the TypoExprs container and it is
not processed by the transform, thereby causing the assertion failure with
clang built with assertions enabled or missing typo diagnostics for getM() if
assertions are disabled.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170906/8b7b11e1/attachment.html>

More information about the llvm-bugs mailing list