Boost logo

Boost Users :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-12-18 00:35:14


Agoston Bejo wrote:
> Has anyone succeeded in specializing class templates with enable_if
> under VC++7.1?

Yes, I do it once in a while. I'd do it more if I didn't have to support old
compilers.

> I have created the simplest example possible and
> cannot imagine how I could rewrite so that no Internal Compiler Error
> occurs.

Obviously the ICE is a microsoft bug. It occurs in VC8.0 beta, too, so it should
be reported.

However, the real problem is that int and float both satisfy is_object and
is_arithmetic, so two partial specializations match equally well.

Here's the output from como 4.3.3:

  "C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp", line 31: error: more
          than one partial specialization matches the template argument list
          of class "A<float, void>"
            "A<T, boost::enable_if<boost::is_arithmetic<T>, void>::type>"
            "A<T, boost::enable_if<boost::is_object<T>, void>::type>"
   cout << Afloat::X << endl; // Internal Compiler Error
                   ^

  "C:\DOCUME~1\turkanis\Home\C++\overloadvc71\example.cpp", line 32: error: more
          than one partial specialization matches the template argument list
          of class "A<int, void>"
            "A<T, boost::enable_if<boost::is_arithmetic<T>, void>::type>"
            "A<T, boost::enable_if<boost::is_object<T>, void>::type>"
     cout << A<int>::X << endl;

Jonathan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net