This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/33098] New: __is_convertible_helper in tr1_impl/type_traits uses deprecated add_reference
- From: "chris dot fairles at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Aug 2007 15:47:26 -0000
- Subject: [Bug libstdc++/33098] New: __is_convertible_helper in tr1_impl/type_traits uses deprecated add_reference
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure CC=gcc43 CXX=g++43 --program-suffix=43
--disable-multilib --enable-languages=c,c++
Thread model: posix
gcc version 4.3.0 20070816 (experimental)
The following code:
#include <type_traits>
int main() {
bool b = std::is_convertible<int*,int*>::value;
}
when compiled with:
g++43 -std=c++0x test.cpp -o test
Gives:
include/c++/4.3.0/type_traits: In instantiation of ?const bool
std::__is_convertible_helper<int*, int*, false>::__value?:
include/c++/4.3.0/type_traits:258: instantiated from
?std::is_convertible<int*, int*>?
test.cpp:5: instantiated from here
include/c++/4.3.0/type_traits:243: error: invalid use of incomplete type
?struct std::add_reference<int*>?
include/c++/4.3.0/tr1_impl/type_traitsfwd.h:157: error: declaration of ?struct
std::add_reference<int*>?
include/c++/4.3.0/type_traits: In instantiation of ?std::is_convertible<int*,
int*>?:
test.cpp:5: instantiated from here
include/c++/4.3.0/type_traits:258: error: ?std::__is_convertible_helper<int*,
int*, false>::__value? is not a valid template argument for type ?bool? because
it is a non-constant expression
test.cpp: In function ?int main()?:
test.cpp:5: error: ?value? is not a member of ?std::is_convertible<int*, int*>?
Besauce the following structure uses deprecated add_reference.
template<typename _From, typename _To,
bool = (is_void<_From>::value || is_void<_To>::value
|| is_function<_To>::value || is_array<_To>::value
// This special case is here only to avoid warnings.
|| (is_floating_point<typename
remove_reference<_From>::type>::value
&& __is_int_or_cref<_To>::__value))>
struct __is_convertible_helper
{
// "An imaginary lvalue of type From...".
static const bool __value = (__is_convertible_simple<typename
add_reference<_From>::type, _To>::__value);
};
FIX:
change add_reference to add_lvalue_reference (see attached patch)
--
Summary: __is_convertible_helper in tr1_impl/type_traits uses
deprecated add_reference
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: chris dot fairles at gmail dot com
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33098