http://llvm.org/bugs/show_bug.cgi?id=12145
Bug #: 12145
Summary: codegen assert: Should not use decl without marking it
used!
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++0x
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected],
[email protected]
Classification: Unclassified
The following code causes clang to assert in codegen:
int a[20]; constexpr int *p = &a[5]; int n = *p;
clang-3.0: src/tools/clang/lib/CodeGen/CGExpr.cpp:1376: clang::CodeGen::LValue
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(const clang::DeclRefExpr *):
Assertion `(ND->isUsed(false) || !isa<VarDecl>(ND) ||
!E->getLocation().isValid()) && "Should not use decl without marking it used!"'
failed.
As far as I can see (please correct me if I'm wrong), we're right to not mark p
as used: it is usable in a constant expression and the lvalue-to-rvalue
conversion is immediately applied. Presumably codegen is simply not trying to
emit the value directly.
--
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs