This is an archive of the discontinued LLVM Phabricator instance.

Leftover expressions for ODR use checking after fatal error [OUTDATED]
Needs ReviewPublic

Authored by azat on Mar 7 2015, 4:12 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Using simple source code:

$ cat /tmp/string.cpp                                                                                                                                                                                                                                                             
#include <string>
int main()
{
        std::string a("a");
        a = std::to_string((float)1);
        return a.length();
}

With clang::ASTFrontendAction::ExecuteAction() the next assertion bails:

/src/oss/clang/lib/Sema/SemaDecl.cpp:10637: clang::Decl* clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool): Assertion `MaybeODRUseExprs.empty() && "Leftover expressions for odr-use checking"' failed.

But if I compile the same source using clang++ everything is fine, because size_t is defined there, while if I use ASTFrontendAction size_t is not defined.

http://lists.cs.uiuc.edu/pipermail/cfe-dev/2015-February/041726.html

Diff Detail

Event Timeline

azat updated this revision to Diff 21434.Mar 7 2015, 4:12 PM
azat retitled this revision from to Leftover expressions for ODR use checking.
azat updated this object.
azat edited the test plan for this revision. (Show Details)
azat updated this object.
azat retitled this revision from Leftover expressions for ODR use checking to Leftover expressions for ODR use checking after fatal error.Mar 19 2015, 11:06 AM
azat edited the test plan for this revision. (Show Details)
azat updated this revision to Diff 22289.Mar 19 2015, 12:09 PM

Add regression test.

azat added a comment.Mar 19 2015, 12:10 PM

Maybe the original patch is not the correct fix, but it works for me, and if somebody will fix this more correctly that would be great!

azat edited the test plan for this revision. (Show Details)Mar 19 2015, 12:12 PM
azat retitled this revision from Leftover expressions for ODR use checking after fatal error to Leftover expressions for ODR use checking after fatal error [OUTDATED].Mar 19 2015, 12:15 PM