[LLVMbugs] [Bug 15884] New: Assertion `(E->isGLValue() || E->getType()->isFunctionType() || E->getType()->isVoidType() || isa<CXXTemporaryObjectExpr>(E)) && "can't evaluate expression as an lvalue"' failed

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 1 03:09:12 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15884

            Bug ID: 15884
           Summary: Assertion `(E->isGLValue() ||
                    E->getType()->isFunctionType() ||
                    E->getType()->isVoidType() ||
                    isa<CXXTemporaryObjectExpr>(E)) && "can't evaluate
                    expression as an lvalue"' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: clang at martinien.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Hi,

the following code fails an assertion on current trunk. This did not happen a
few weeks ago.


struct Segment;

struct ld_Ref
{
    const Segment* operator->() const;
};

struct Segment {
    ld_Ref getNextAtomic() const;
};

void f()
{
    unsigned long l;
    const ld_Ref* segment = reinterpret_cast<const ld_Ref *>(l);
    segment = &((*segment)->getNextAtomic());
}



fail.cpp:16:15: error: taking the address of a temporary object of type
'ld_Ref' [-Waddress-of-temporary]
    segment = &((*segment)->getNextAtomic());
              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
clang: /local/mar_/llvmtrunk/tools/clang/lib/AST/ExprConstant.cpp:3225: bool
EvaluateLValue(const clang::Expr *, <anonymous>::LValue &,
<anonymous>::EvalInfo &): Assertion `(E->isGLValue() ||
E->getType()->isFunctionType() || E->getType()->isVoidType() ||
isa<CXXTemporaryObjectExpr>(E)) && "can't evaluate expression as an lvalue"'
failed.


16 clang           0x0000000001192625
_ZNK5clang4Expr19EvaluateForOverflowERKNS_10ASTContextEPN4llvm15SmallVectorImplISt4pairINS_14SourceLocationENS_17PartialDiagnosticEEEE
+ 309
17 clang           0x0000000000a11f8f
_ZN5clang4Sema19CheckForIntOverflowEPNS_4ExprE + 95
18 clang           0x0000000000b84729
_ZN5clang4Sema19ActOnFinishFullExprEPNS_4ExprENS_14SourceLocationEbb + 233
19 clang           0x0000000000c17297
_ZN5clang4Sema13ActOnExprStmtENS_12ActionResultIPNS_4ExprELb1EEE + 55
20 clang           0x00000000009bef51 _ZN5clang6Parser18ParseExprStatementEv +
689



1.      fail.cpp:17:1: current parser token '}'
2.      fail.cpp:13:1: parsing function body 'f'
3.      fail.cpp:13:1: in compound statement ('{}')



clang version 3.3 (trunk 180834)
Target: x86_64-unknown-linux-gnu
Thread model: posix


Best regards,
Martin

-- 
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/20130501/cd4bc902/attachment.html>


More information about the llvm-bugs mailing list