Boost version: 1.67.0
Compiler: GCC 7.3.0
Environment: Cygwin on Windows 10 version 1709
In the Boost Concept Check library, CopyConstructible concept requires
operator & applicable to the type being checked, and the return value is
required to be convertible to pointer to the type.
However, pointer to reference is not allowed in C++. This concept check
fails to compile if applying to a lvalue reference type.
On the other hand, is_copy_constructible<T> type trait class in the Boost
Type Traits library and the standard C++ library both give positive result
on lvalue reference types.
For example, the following code snippet will fail to compile if T is a
lvalue reference:
#include
#include
#include
#include
#include
template <typename T>
void RequireCopyConstructible()
{
BOOST_STATIC_ASSERT(boost::is_copy_constructible<T>::value); // PASS on
lvalue reference
BOOST_STATIC_ASSERT(std::is_copy_constructible<T>::value); // PASS on
lvalue reference
BOOST_CONCEPT_ASSERT((boost::CopyConstructible<T>)); // FAIL on
lvalue reference
}
void TestReference()
{
RequireCopyConstructible();
}
Diagnosis message is generated as: "error: forming pointer to reference
type ‘int&’".
I think the operator & applicable requirement should be removed for
CopyConstructible concept.
Alternatively, adding a template specialization on lvalue reference type
for CopyConstructible concept may work as well.