c++/10867: Internal compiler error with constant enum

[email protected]
Newsgroups gmane.comp.gcc.prs
Message-ID <20030519163309.24353.qmail__49530.9847211049$1053362121@sources.redhat.com>
>Number:         10867
>Category:       c++
>Synopsis:       Internal compiler error with constant enum
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 19 16:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Lloyd Lewins
>Release:        gcc version 3.2
>Organization:
>Environment:
Cygwin
>Description:
The attached file generates the following error:

conversion.cc:8: warning: all member functions in class `Conversion<T, U>' are
   private
conversion.cc: In instantiation of `const unsigned int Conversion<double, int>::
t':
conversion.cc:23:   instantiated from `Conversion<double, int>'
conversion.cc:23:   instantiated from here
conversion.cc:15: Internal compiler error in instantiate_decl, at cp/pt.c:10052
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="conversion.cc"
Content-Disposition: inline; filename="conversion.cc"

#include <vector>
#include <iostream>

using namespace std;

template<class T, class U>
class Conversion
{
    typedef char Small;
    class Big { char dummy[2]; };
    static Small Test(U);
    static Big Test(...);
    static T MakeT();
public:
    static const unsigned t = sizeof(MakeT());
    enum {
        exists = t
    };
};

int main(void)
{
    Conversion<double, int> d;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.