[cfe-dev] Compound literals in C++: why rvalue?

Eli Friedman eli.friedman at gmail.com
Wed Jan 11 09:46:55 PST 2012


On Wed, Jan 11, 2012 at 7:14 AM, Enea Zaffanella <zaffanella at cs.unipr.it> wrote:
> $ clang++ -Waddress-of-temporary -c bug.cc
> bug.cc:1:16: warning: taking the address of a temporary object of type
> 'int [1]'
>      [-Waddress-of-temporary]
> int (*pa)[1] = &(int[]) { 1 };
>               ^~~~~~~~~~~~~~
> clang: <path>/tools/clang/lib/AST/ExprConstant.cpp:2479: bool
> EvaluateLValue(const clang::Expr*, <unnamed>::LValue&,
> <unnamed>::EvalInfo&): Assertion `(E->isGLValue() ||
> E->getType()->isFunctionType() || E->getType()->isVoidType() ||
> isa<CXXTemporaryObjectExpr>(E)) && "can't evaluate expression as an
> lvalue"' failed.
> [...]

Please file a bug report for the crash.

-Eli




More information about the cfe-dev mailing list