c++/2532: Internal compiler Error in template
mgeddes@cybergraphic.com.au
mgeddes@cybergraphic.com.au
Wed Apr 11 00:56:00 GMT 2001
>Number: 2532
>Category: c++
>Synopsis: Internal compiler Error in template
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Apr 11 00:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Michael Geddes
>Release: gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
>Organization:
>Environment:
Win32
>Description:
Compilation of this Code Crashes (no includes)
Both the is_const and is_volatile instantiations crash.
namespace detail{
typedef char yes_result;
typedef char (&no_result)[8];
yes_result is_const_helper(const volatile void*);
no_result is_const_helper(volatile void *);
yes_result is_volatile_helper(const volatile void*);
no_result is_volatile_helper(const void *);
}
template <typename T> struct is_const
{
private:
static T t;
public:
enum{ result = (sizeof(detail::yes_result) == sizeof(detail::is_const_helper(&t))) };
};
template <typename T> struct is_volatile
{
private:
static T t;
public:
enum{ result = (sizeof(detail::yes_result) == sizeof(detail::is_volatile_helper(&t))) };
};
is_const<int> fred;
is_volatile<int> fred;
>How-To-Repeat:
Compile the speficied code
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list