mirror of
https://github.com/boostorg/core.git
synced 2026-01-30 19:52:17 +00:00
Implement constexpr addressof
This commit is contained in:
@@ -13,6 +13,7 @@ run addressof_test.cpp ;
|
||||
run addressof_test2.cpp ;
|
||||
run addressof_np_test.cpp ;
|
||||
run addressof_fn_test.cpp ;
|
||||
compile addressof_constexpr_test.cpp ;
|
||||
|
||||
run checked_delete_test.cpp ;
|
||||
compile-fail checked_delete_fail.cpp ;
|
||||
|
||||
21
test/addressof_constexpr_test.cpp
Normal file
21
test/addressof_constexpr_test.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
Copyright 2017 Glen Joseph Fernandes
|
||||
<glenjofe -at- gmail.com>
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
*/
|
||||
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#if !defined(BOOST_CORE_NO_CONSTEXPR_ADDRESSOF)
|
||||
struct Type { };
|
||||
|
||||
static int v1 = 0;
|
||||
static Type v2 = { };
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::addressof(v1) == &v1);
|
||||
BOOST_STATIC_ASSERT(boost::addressof(v2) == &v2);
|
||||
#endif
|
||||
Reference in New Issue
Block a user