Opened 11 years ago

Closed 11 years ago

#1626 closed Bugs (fixed)

[type_traits] "bad_alloc is not a member of std" in has_virtual_destructor_test.cpp

Reported by: faridz@… Owned by: John Maddock
Milestone: To Be Determined Component: type_traits
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

I've got the following errors while testing the boost with stdcxx library on icc-10.1/Linux:

../libs/type_traits/test/has_virtual_destructor_test.cpp(58): error: namespace "std" has no member "bad_alloc"
  BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::bad_alloc>::value, true, false);
  ^

../libs/type_traits/test/has_virtual_destructor_test.cpp(58): error: namespace "std" has no member "bad_alloc"
  BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::bad_alloc>::value, true, false);
  ^

../libs/type_traits/test/has_virtual_destructor_test.cpp(58): error: namespace "std" has no member "bad_alloc"
  BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::bad_alloc>::value, true, false);
  ^

../libs/type_traits/test/has_virtual_destructor_test.cpp(58): error: namespace "std" has no member "bad_alloc"
  BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::bad_alloc>::value, true, false);
  ^

../libs/type_traits/test/has_virtual_destructor_test.cpp(58): error: namespace "std" has no member "bad_alloc"
  BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::bad_alloc>::value, true, false);
  ^

../libs/type_traits/test/has_virtual_destructor_test.cpp(58): error: namespace "std" has no member "bad_alloc"
  BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_virtual_destructor<std::bad_alloc>::value, true, false);
  ^

compilation aborted for ../libs/type_traits/test/has_virtual_destructor_test.cpp (code 2)

The same result on gcc/Linux:

../libs/type_traits/test/has_virtual_destructor_test.cpp: In function ???int main()???:
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: ???bad_alloc??? is not a member of ???std???
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: ???bad_alloc??? is not a member of ???std???
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: template argument 1 is invalid
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: template argument 1 is invalid
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: ???bad_alloc??? is not a member of ???std???
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: ???bad_alloc??? is not a member of ???std???
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: template argument 1 is invalid
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: ???bad_alloc??? is not a member of ???std???
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: ???bad_alloc??? is not a member of ???std???
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: template argument 1 is invalid
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: ???bad_alloc??? is not a member of ???std???
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: ???bad_alloc??? is not a member of ???std???
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: template argument 1 is invalid
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: ???bad_alloc??? is not a member of ???std???
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: ???bad_alloc??? is not a member of ???std???
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: template argument 1 is invalid
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: template argument 1 is invalid
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: ???bad_alloc??? is not a member of ???std???
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: ???bad_alloc??? is not a member of ???std???
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: template argument 1 is invalid
../libs/type_traits/test/has_virtual_destructor_test.cpp:58: error: template argument 1 is invalid

I propose to #include <new> to define std::bad_alloc class:

Index: libs/type_traits/test/has_virtual_destructor_test.cpp
===================================================================
--- libs/type_traits/test/has_virtual_destructor_test.cpp	(revision 43111)
+++ libs/type_traits/test/has_virtual_destructor_test.cpp	(working copy)
@@ -12,6 +12,7 @@
 #  include <boost/type_traits/has_virtual_destructor.hpp>
 #endif
 
+#include <new>
 #include <iostream>
 #include <stdexcept>

Change History (1)

comment:1 Changed 11 years ago by John Maddock

Resolution: fixed
Status: newclosed

Confirmed and fixed in Trunk.

Note: See TracTickets for help on using tickets.