Opened 18 years ago

Closed 15 years ago

#282 closed Support Requests (wontfix)

boost::optional<enum> fails with /CLR

Reported by: nobody Owned by: Fernando Cacciola
Milestone: Component: optional
Version: None Severity: Problem
Keywords: Cc:

Description (last modified by Marshall Clow)

-----
#include <boost\optional.hpp>

#using <mscorlib.dll>
#include <tchar.h>

using namespace System;

enum Numbers { Zero, One, Two, Three };

// This is the entry point for this application
int _tmain(void)
{
	boost::optional<Numbers> num;

    return 0;
}
-----

optional.hpp(347): error C2300: 'System::Enum' : class 
does not have a destructor called '~T'

I'm using boost 1.31.0; this fails in both VC7.0 and 
VC7.1.

Removing "#using <mscorlib.dll>" and "using namespace 
System;" gets rid of the compiler error, but then you 
can't use things like System::String*

Thanks,
   Dan

sourceforge.net@jdanielsmith.org


Change History (3)

comment:1 by Marshall Clow, 15 years ago

Component: Noneoptional
Description: modified (diff)
Severity: Problem
Status: assignednew

comment:2 by anonymous, 15 years ago

Unfortunately this is due to a framework bug: System::Enum does not have a destructor (is an enum) but doesn't support a pseudo-destructor call either (see 12.4.15) which is neccesary to allow the code to compile without complaining about the lack of a destructor.

comment:3 by Fernando Cacciola, 15 years ago

Resolution: Nonewontfix
Status: newclosed

(I wrote the response about but without logging in, accidentally)

Note: See TracTickets for help on using tickets.