<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Assertion `(E->isGLValue() || E->getType()->isFunctionType() || E->getType()->isVoidType() || isa<CXXTemporaryObjectExpr>(E)) && "can't evaluate expression as an lvalue"' failed"
   href="http://llvm.org/bugs/show_bug.cgi?id=15884">15884</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion `(E->isGLValue() || E->getType()->isFunctionType() || E->getType()->isVoidType() || isa<CXXTemporaryObjectExpr>(E)) && "can't evaluate expression as an lvalue"' failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>clang@martinien.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>