[LLVMbugs] [Bug 10107] Address of compound literal fails in gnu++0x but not C99

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 11 11:35:43 PST 2012


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

Enea Zaffanella <zaffanella at cs.unipr.it> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |zaffanella at cs.unipr.it
         Resolution|INVALID                     |

--- Comment #3 from Enea Zaffanella <zaffanella at cs.unipr.it> 2012-01-11 13:35:43 CST ---
As of r147790, clang still crashes on the following line of code, if
-W[no-]address-of-temporary is used:


$ cat bug.cc
int (*pa)[1] = &(int[]) { 1 };


$ clang++ -c bug.cc
bug.cc:1:16: error: taking the address of a temporary object of type
'int [1]'
      [-Waddress-of-temporary]
int (*pa)[1] = &(int[]) { 1 };
               ^~~~~~~~~~~~~~
1 error generated.


$ 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.
[...]

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list