Boost logo

Boost :

From: Krishna Achuthan (TT) (Krishna.Achuthan_at_[hidden])
Date: 2004-03-09 12:53:34


I was able to cut the code down to this and got an ICE in VC 7.1:

struct Base
{
  template <typename T> operator T()
  {
    return T();
  }
};

struct Derived : Base
{
/*
  template <typename T> operator T()
  {
    return T();
  }
*/
};

int main()
{
  float f = Derived(); //ICE here
}

Notice that once you uncomment the function in the Derived class and hide
the function in Base class, the ICE goes away.

- Krishna Achuthan

> Message: 10
> Date: Mon, 8 Mar 2004 21:15:27 +0100
> From: Bronek Kozicki <brok_at_[hidden]>
> Subject: [boost] Re: [math constants] C++ Language gurus views
> neededandCodewarrior & Comeau testers
> To: boost_at_[hidden]
> Message-ID: <g2gf20rte3qn.tx7plyoud13i.dlg_at_[hidden]>
> Content-Type: text/plain; charset="us-ascii"
>
> On Mon, 08 Mar 2004 10:47:49 +0100, Daniel Frey wrote:
> > but that's just a wild guess. I just seem to remember that I read about
> > the VC having a small problem there. If this is in fact the problem, we
> > might be lucky as my newest version no longer uses this conversion,
> > instead I use a get<T>-function.
>
> I can reproduce this ICE on following code:
>
> template<template <typename> class F> struct constant
> {
> template <typename T> operator T() const
> {
> return F <T>()();
> }
> };
>
> template <typename T> struct map_type;
>
> template <template<typename> class F, typename T> struct constant_value
> {
> T operator()() const
> {
> return F<typename ::map_type<T> ::type>()();
> }
> };
>
> template <typename T> struct pi_value : constant_value< ::pi_value, T >
> {};
> template <> struct pi_value <float> {float operator()() const {return
> 3.14;}};
>
> struct pi_t : constant <pi_value> {} const pi = pi_t();
>
> int main()
> {
> const float f2 = pi; // ICE here
> }
>
> possibly it can be made smaller, I just finished cutting it at this
> moment and sent to private MS newsgroup asking for support. Comeau and
> GCC both happily accept this code, and it just looks OK. However it's
> bit too complicated and I'm too tired to look into it deeper. I hope
> someone from VC71 developers will now take a look. VC71 quite often
> bulks on invalid code, but if this one is valid (I certainly think so)
> then we have issue that have to be fixed . In the meantime if you can
> come up with some variations of the above, just send an email and I will
> test it. BTW: problem with operator() and VC71 is that it does not
> always recognize operator() as function, in context of pointer to member
> function. However it does not ICE on that problem.
>
> Regards
>
>
> B.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk