<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Exception catching problem when using boost::variant and boost: in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744105#M1544</link>
    <description>This issue should be resolve in the latest 11.1 and Composer products.</description>
    <pubDate>Tue, 18 Jan 2011 23:06:22 GMT</pubDate>
    <dc:creator>Quoc-An_L_Intel</dc:creator>
    <dc:date>2011-01-18T23:06:22Z</dc:date>
    <item>
      <title>Exception catching problem when using boost::variant and boost::any</title>
      <link>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744099#M1538</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;
&lt;P&gt;I've run into a problem involving exception handling when using boost::any, boost::variant and the Intel Parallel Composer C++ compiler. Below is a simple example that recreates the issue.&lt;/P&gt;
&lt;P&gt;The problem is that even though the switch statement is wrapped in a try-catch block, if case 2 throws an exception the exception is not caught by the catch block and the program terminates.&lt;/P&gt;
&lt;P&gt;This appears to be caused by the line "temp.reset(new boost::any(Foo()))" in case 1 and the fact that the Foo class has a member that is a boost::variant. If Foo has no such member the example below behaves as expected (i.e the exception that is thrown is caught by the catch block). The code below also behaves correctly when using MSVC.&lt;/P&gt;
&lt;P&gt;EDIT - I've had no luck in getting the forum to accept angled brackets - they are just getting removed along with whatever they contain. I have replaced them with the symbol "$".&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;PRE&gt;[cpp]
#include $stdexcept$&lt;BR /&gt;#include $memory$&lt;BR /&gt;#include $boost/variant.hpp$&lt;BR /&gt;#include $boost/any.hpp$&lt;BR /&gt;&lt;BR /&gt;typedef boost::variant$ float, bool $ Value;
typedef std::tr1::shared_ptr$boost::any$ pointerToAny;

class Foo
{
public:
	Foo()
	{}

private:
	Value m_val;
};

void Switch(int i)
{
	pointerToAny temp;

	try
	{
		switch(i)
		{
		case 1:
			temp.reset(new boost::any(Foo()));
			break;

		case 2:
			throw std::runtime_error("Case 2 threw");
			break;
		}
	}
	catch(...)
	{
	}
}

int main()
{
	Switch(2);
	
	return 0;
}[/cpp]&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2010 16:39:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744099#M1538</guid>
      <dc:creator>emke88</dc:creator>
      <dc:date>2010-02-26T16:39:46Z</dc:date>
    </item>
    <item>
      <title>Exception catching problem when using boost::variant and boost:</title>
      <link>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744100#M1539</link>
      <description>&lt;P&gt;I get syntax error for the edited code below. I replaced the $ with angle brackets.&lt;/P&gt;
&lt;P&gt;typedef std::tr1::shared_ptr $ boost::any $ pointerToAny;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;u72319&amp;gt;cl -c test.cpp -EHsc&lt;/P&gt;
&lt;P&gt;Microsoft  32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86&lt;/P&gt;
&lt;P&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;/P&gt;
&lt;P&gt;test.cpp&lt;/P&gt;
&lt;P&gt;test.cpp(8) : error C3083: 'tr1': the symbol to the left of a '::' must be a type&lt;/P&gt;
&lt;P&gt;test.cpp(8) : error C2039: 'shared_ptr' : is not a member of 'std'&lt;/P&gt;
&lt;P&gt;test.cpp(8) : error C2143: syntax error : missing ';' before '&amp;lt;'&lt;/P&gt;
&lt;P&gt;test.cpp(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2010 20:40:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744100#M1539</guid>
      <dc:creator>Quoc-An_L_Intel</dc:creator>
      <dc:date>2010-03-01T20:40:09Z</dc:date>
    </item>
    <item>
      <title>Exception catching problem when using boost::variant and boost:</title>
      <link>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744101#M1540</link>
      <description>BTW, I got the error with boost version Boost_1_42_0.</description>
      <pubDate>Mon, 01 Mar 2010 20:48:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744101#M1540</guid>
      <dc:creator>Quoc-An_L_Intel</dc:creator>
      <dc:date>2010-03-01T20:48:09Z</dc:date>
    </item>
    <item>
      <title>Exception catching problem when using boost::variant and boost:</title>
      <link>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744102#M1541</link>
      <description>&lt;P&gt;Thanks for your reply.&lt;/P&gt;
&lt;P&gt;You're getting that syntax error because the compiler you're using has no support for tr1. My original problem can still be reproduced when using a boost::shared_ptr so I suggest you replace the line:&lt;/P&gt;
&lt;P&gt;typedef std::tr1::shared_ptr $ boost::any $ pointerToAny;&lt;/P&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;P&gt;typedef boost::shared_ptr $ boost::any $ pointerToAny;&lt;/P&gt;
&lt;P&gt;You'll also need to add an additional include directive:&lt;/P&gt;
&lt;P&gt;#include $ boost/shared_ptr.hpp $&lt;/P&gt;
&lt;P&gt;Hope this works for you.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2010 09:14:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744102#M1541</guid>
      <dc:creator>emke88</dc:creator>
      <dc:date>2010-03-02T09:14:38Z</dc:date>
    </item>
    <item>
      <title>Exception catching problem when using boost::variant and boost:</title>
      <link>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744103#M1542</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; You're getting that syntax error because the compiler you're using has no support for tr1...&lt;/P&gt;
&lt;P&gt;MSVS2008 compiler also fails to compile the source file using boost version1_42_0&lt;/P&gt;
&lt;P&gt;I was able to compile without modifying the source as suggested using boost version 1_35_0, and I was able to reproduce the error.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2010 18:32:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744103#M1542</guid>
      <dc:creator>Quoc-An_L_Intel</dc:creator>
      <dc:date>2010-03-02T18:32:38Z</dc:date>
    </item>
    <item>
      <title>Exception catching problem when using boost::variant and boost:</title>
      <link>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744104#M1543</link>
      <description>&lt;P&gt;#include &amp;amp;ltstdio.h&amp;gt;&lt;/P&gt;
&lt;P&gt;Angle brackets and ampersand are escape character for html. To get them to show correctly, I had to do the following:&lt;/P&gt;
&lt;P&gt;#include [ampersand symbol][lt]stdio.h[ampersand symbol][gt] (leave out the square brackets []).&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2010 18:57:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744104#M1543</guid>
      <dc:creator>Quoc-An_L_Intel</dc:creator>
      <dc:date>2010-03-02T18:57:55Z</dc:date>
    </item>
    <item>
      <title>Exception catching problem when using boost::variant and boost:</title>
      <link>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744105#M1544</link>
      <description>This issue should be resolve in the latest 11.1 and Composer products.</description>
      <pubDate>Tue, 18 Jan 2011 23:06:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Exception-catching-problem-when-using-boost-variant-and-boost/m-p/744105#M1544</guid>
      <dc:creator>Quoc-An_L_Intel</dc:creator>
      <dc:date>2011-01-18T23:06:22Z</dc:date>
    </item>
  </channel>
</rss>

