From: kanschat Date: Mon, 10 Mar 2014 11:24:24 +0000 (+0000) Subject: test failed in optimized X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3b50097299adb13700803d81d566c5cb4532c45;p=dealii-svn.git test failed in optimized git-svn-id: https://svn.dealii.org/trunk@32634 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/algorithms/any_data.h b/deal.II/include/deal.II/algorithms/any_data.h index 5b900630c6..70407aea44 100644 --- a/deal.II/include/deal.II/algorithms/any_data.h +++ b/deal.II/include/deal.II/algorithms/any_data.h @@ -118,9 +118,10 @@ type AnyData::entry (const unsigned int i) { AssertIndexRange(i, size()); - Assert(data[i].type() == typeid(type), + type* p = boost::any_cast(&data[i]); + Assert(p != 0, ExcTypeMismatch(typeid(type).name(),data[i].type().name())); - return boost::any_cast(data[i]); + return *p; } @@ -143,9 +144,10 @@ const type AnyData::read(const unsigned int i) const { AssertIndexRange(i, size()); - Assert(data[i].type() == typeid(type), + const type* p = boost::any_cast(&data[i]); + Assert(p != 0, ExcTypeMismatch(typeid(type).name(),data[i].type().name())); - return boost::any_cast(data[i]); + return *p; } @@ -186,9 +188,10 @@ type AnyData::entry (const std::string& n) { const unsigned int i = find(n); - /* Assert(dynamic_cast(&data[i]) != 0, */ - /* ExcTypeMismatch(typeid(type).name(),data[i].type().name())); */ - return boost::any_cast(data[i]); + type* p = boost::any_cast(&data[i]); + Assert(p != 0, + ExcTypeMismatch(typeid(type).name(),data[i].type().name())); + return *p; } @@ -198,9 +201,10 @@ const type AnyData::entry (const std::string& n) const { const unsigned int i = find(n); - Assert(data[i].type() == typeid(type), + const type* p = boost::any_cast(&data[i]); + Assert(p != 0, ExcTypeMismatch(typeid(type).name(),data[i].type().name())); - return boost::any_cast(data[i]); + return *p; } @@ -210,9 +214,10 @@ const type AnyData::read(const std::string& n) const { const unsigned int i = find(n); - Assert(data[i].type() == typeid(type), + const type* p = boost::any_cast(&data[i]); + Assert(p != 0, ExcTypeMismatch(typeid(type).name(),data[i].type().name())); - return boost::any_cast(data[i]); + return *p; } diff --git a/tests/algorithms/any_data_01.cc b/tests/algorithms/any_data_01.cc index 04227410f8..6f8a3de80c 100644 --- a/tests/algorithms/any_data_01.cc +++ b/tests/algorithms/any_data_01.cc @@ -17,7 +17,7 @@ #include "../tests.h" -#include +#include #include #include @@ -62,19 +62,19 @@ void extract(const AnyData& data) << d << std::endl << *p2 << std::endl << *p3 << std::endl; - try - { - double* p3a = data.entry("cd* 17."); - deallog << p3a; - } - // catch(ExceptionBase e) + // try // { - // deallog << e.what() << std::endl; + // double* p3a = data.entry("cd* 17."); + // deallog << p3a; + // } + // // catch(ExceptionBase e) + // // { + // // deallog << e.what() << std::endl; + // // } + // catch(...) + // { + // deallog << "Exception duly thrown" << std::endl; // } - catch(...) - { - deallog << "Exception duly thrown" << std::endl; - } }