]> granicus.if.org Git - clang/commit
Add a __builtin_addressof that performs the same functionality as the built-in
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 11 Jul 2013 02:27:57 +0000 (02:27 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 11 Jul 2013 02:27:57 +0000 (02:27 +0000)
commit5154dce6388e3aaa445467030df7a45ed1211abe
treea2f16f8f225d435868a4941c731aee3f8255d0d9
parent27ec2d0acc51fc661f3ab10693565f5f0653b294
Add a __builtin_addressof that performs the same functionality as the built-in
& operator (ignoring any overloaded operator& for the type). The purpose of
this builtin is for use in std::addressof, to allow it to be made constexpr;
the existing implementation technique (reinterpret_cast to some reference type,
take address, reinterpert_cast back) does not permit this because
reinterpret_cast between reference types is not permitted in a constant
expression in C++11 onwards.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186053 91177308-0d34-0410-b5e6-96231b3b80d8
docs/LanguageExtensions.rst
include/clang/Basic/Builtins.def
lib/AST/ExprConstant.cpp
lib/CodeGen/CGBuiltin.cpp
lib/Sema/SemaChecking.cpp
test/CodeGenCXX/builtins.cpp
test/SemaCXX/builtins.cpp