This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++, 2.95: ICE with ?: operator



// This strange bit of code produces an ICE.
// Configuration:
//    gcc version 2.95 19990728 (release)
//    sparc-sun-solaris2.6
//
// gcc output:
//     tmp/x> c++ -c a.cc
//     a.cc: In method `void Outer::test()':
//     a.cc:41: Internal compiler error 364.
//     a.cc:41: Please submit a full bug report to
`egcs-bugs@egcs.cygnus.com'.
//     a.cc:41: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for
details.
//     
// Notes:
//  - first casting inner_[12] to (Base&) solves the problem and needs
//    indeed be done, if I understand the standard right
//  - the "template<>" is commented out since it is not accepted (see
//    my previous mail)
// Best regards,
//   Wolfgang
//
struct Outer 
{
    class Base {};
    template <int dim> class Inner    : public Base {};
/*  template <> */     class Inner<1> : public Base {};
/*  template <> */     class Inner<2> : public Base {};

    Inner<1> inner_1;
    Inner<2> inner_2;

    void test ();
};

void Outer::test () 
{
  const unsigned int dim = 1;
  Base &base_reference = ((dim == 1) ?
			  inner_1 :
			  ((dim == 2) ?
			   inner_2 :
			   *(Base*)0));
};


-------------------------------------------------------------------------
Wolfgang Bangerth          email: wolfgang.bangerth@iwr.uni-heidelberg.de
                             www: http://gaia.iwr.uni-heidelberg.de/~wolf





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]