Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Forwarding 0 as a pointer using rvalue references doesn't work #3829

Closed Quuxplusone closed 14 years ago

Quuxplusone commented 14 years ago
Bugzilla Link PR6508
Status RESOLVED DUPLICATE of bug 6507
Importance P normal
Reported by Ahmed Charles (acharles@outlook.com)
Reported on 2010-03-05 03:05:38 -0800
Last modified on 2010-03-16 14:03:34 -0700
Version trunk
Hardware PC Windows XP
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
std::pair in c++0x has additional constructor overloads which take rvalue
references and forward them to the stored type's constructors. Rvalue
references forward 0 as an int rather than as a pointer. nullptr can be used to
solve this problem, but since that is not universally supported,
static_cast'ing the 0 to the expected pointer type is sufficient.

include/clang/Analysis/ProgramPoint.h:62
include/clang/AST/DeclContextInternals.h:157
lib/AST/DeclBase.cpp:796
lib/AST/DeclBase.cpp:802
lib/AST/Expr.cpp:2160
lib/AST/Expr.cpp:2162
lib/Checker/GRExprEngine.cpp:1872
Quuxplusone commented 14 years ago

I don't know what to do with this bug, are you saying that clang doesn't build with a c++'0x compiler? If so, can you provide a patch to fix this?

Quuxplusone commented 14 years ago
Basically, you just need to change:

std::pair<Foo*, Bar*>(0, 0);

to:

std::pair<Foo*, Bar*>(static_cast<Foo*>(0), static_cast<Bar*>(0));
Quuxplusone commented 14 years ago

_This bug has been marked as a duplicate of bug 6507_