[llvm-bugs] [Bug 34420] New: assert in lib/Sema/SemaExpr.cpp triggers
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Sep 1 17:10:45 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34420
Bug ID: 34420
Summary: assert in lib/Sema/SemaExpr.cpp triggers
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: doj at cubic.org
CC: llvm-bugs at lists.llvm.org
I was running the clang-tidy program on my company's source code and it was
always triggering an assert() in lib/Sema/SemaExpr.cpp
Sema::PerformObjectMemberConversion() I have changed the assert() to return an
error status, this made clang-tidy run for me, but it is probably not the
correct solution. See the following patch:
Index: lib/Sema/SemaExpr.cpp
===================================================================
--- lib/Sema/SemaExpr.cpp (revision 311486)
+++ lib/Sema/SemaExpr.cpp (working copy)
@@ -2611,7 +2611,10 @@
// We only need to do this if the naming-class to declaring-class
// conversion is non-trivial.
if (!Context.hasSameUnqualifiedType(FromRecordType, URecordType)) {
- assert(IsDerivedFrom(FromLoc, FromRecordType, URecordType));
+ // doj: fails for my code
+ if (! IsDerivedFrom(FromLoc, FromRecordType, URecordType))
+ return ExprError();
+
CXXCastPath BasePath;
if (CheckDerivedToBaseConversion(FromRecordType, URecordType,
FromLoc, FromRange, &BasePath))
This is my first adventure with llvm and clang. How can I better fix this? The
assert is of course triggered when parsing a large and ugly source code file,
that may not be easy for me to reduce to the expression that triggers the
assert.
--
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/20170902/9f0215ac/attachment.html>
More information about the llvm-bugs
mailing list