[llvm-bugs] [Bug 38189] New: Assertion failure after bad typo correction

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 16 18:24:13 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38189

            Bug ID: 38189
           Summary: Assertion failure after bad typo correction
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rtrieu at google.com
                CC: llvm-bugs at lists.llvm.org

In the following example, the using declaration is incorrect since it refers to
a non-existent class.  Clang attempts to typo-correct this, but the correction
is a function instead of a class.  This later triggers an assertion.

$ cat test.cc
template <class T>
struct ptr {
  ptr(T*);
};

namespace NS {
struct _First__End_ {
  static ptr<_First__End_> New_SecondPart__End_();
};
}  // namespace NS

using NS::_First__SecondPart__End_;

void run() {
  ptr<_First__SecondPart__End_> un = _First__SecondPart__End_::NewInstance();
}

$ clang test.cc
test.cc:12:7: error: no member named '_First__SecondPart__End_' in namespace
      'NS'; did you mean 'NS::_First__End_::New_SecondPart__End_'?
using NS::_First__SecondPart__End_;
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      NS::_First__End_::New_SecondPart__End_
test.cc:8:28: note: 'NS::_First__End_::New_SecondPart__End_' declared here
  static ptr<_First__End_> New_SecondPart__End_();
                           ^
test.cc:15:7: error: use of undeclared identifier '_First__SecondPart__End_';
      did you mean 'New_SecondPart__End_'?
  ptr<_First__SecondPart__End_> un = _First__SecondPart__End_::NewInstance();
      ^~~~~~~~~~~~~~~~~~~~~~~~
      New_SecondPart__End_
test.cc:12:11: note: 'New_SecondPart__End_' declared here
using NS::_First__SecondPart__End_;
          ^
clang-7.0: ../tools/clang/lib/Sema/SemaExprMember.cpp:91: IMAKind
ClassifyImplicitMemberAccess(clang::Sema &, const clang::LookupResult &):
Assertion `!R.empty() && (*R.begin())->isCXXClassMember()' failed.

-- 
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/20180717/15096d0b/attachment.html>


More information about the llvm-bugs mailing list