[Insight-developers] GetInverseTransform - MSVC 6 instantiation bug

Luis Ibanez luis.ibanez at kitware.com
Thu Apr 9 10:14:41 EDT 2009


Hi Tom,

Here is what I have found so far:
The problem in VS6.0 can be replicated with the following minimal code:


template <class T, unsigned int N, unsigned int M>
class FOO
{
public:
  typedef T  SomeTrait;
  typedef FOO<T,M,N> BAR;
  typedef typename BAR::SomeTrait  BARTrait;   // <<-----THIS

  BAR GetInverse()
    {
    BAR a;
    return a;
    }
};


int main()
{
   typedef FOO<float, 3, 2>  FooType;
   FooType foo;
   FooType::BAR at = foo.GetInverse();
   return 0;
}


This generates the now familiar-looking compilation error:

G:\bin\TenplateRecurssion\main.cxx(10) : error C2027: use of undefined
type 'FOO<float,3,2>'
        G:\bin\TenplateRecurssion\main.cxx(10) : see reference to
class template instantiation 'FOO<float,2,3>' being compiled
        G:\bin\TenplateRecurssion\main.cxx(24) : see reference to
class template instantiation 'FOO<float,3,2>' being compiled
Error executing cl.exe.

TenplateRecurssion.exe - 1 error(s), 0 warning(s)


Note the transposition of 3,2 and 2,3.

The line with the "THIS" label is the one that triggers the compilation error.

As you pointed out, it seems that we are missing to use some
mechanism for forcing VS6.0 to instantiate the InverseType,
before we attempt to use a trait from it.

...still looking into it...



   Luis




--------------------------------------------------------------------------
On Thu, Apr 9, 2009 at 9:33 AM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>
> Starting up my Visual Studio 6.0 compiler...
>
> It's going to be long morning...
>
>
>
>     Luis
>
>
> -----------------------
> Tom Vercauteren wrote:
>>
>> Hi all,
>>
>> The dashboard is giving me the following error on visual 6 compiler:
>>
>> c:\Dashboards\My
>> Tests\InsightContinuous\Code\Common\itkTransform.h(120) : error C2027:
>> use of undefined type 'Transform<double,3,2>'
>>
>>        c:\Dashboards\My
>> Tests\InsightContinuous\Code\Common\itkTransform.h(120) : see
>> reference to class template instantiation 'itk::Transform<double,2,3>'
>> being compiled
>>        c:\Dashboards\My
>> Tests\InsightContinuous\Code\Common\itkRigid3DPerspectiveTransform.h(42)
>> : see reference to class template instantiation
>> 'itk::Transform<double,3,2>' being compiled
>>        c:\Dashboards\My
>> Tests\InsightContinuous\Code\Common\itkTransformFactory.h(37) : see
>> reference to class template instantiation
>> 'itk::Rigid3DPerspectiveTransform<double>' being compiled
>>        c:\Dashboards\My
>> Tests\InsightContinuous\Code\Common\itkTransformFactory.h(36) : while
>> compiling class-template member function 'void __cdecl
>> itk::TransformFactory<class itk::Rigid3DPerspectiveTransform<double>
>>
>>> ::RegisterTransform(void)'
>>
>>
>> http://www.cdash.org/CDash/viewBuildError.php?buildid=309403
>>
>> Can anyone help me understand what this means?
>>
>> I initially thought that this might be related to explicit
>> instantiation since itk::Transform<double,3,2> is not listed in:
>>
>> http://www.itk.org/cgi-bin/viewcvs.cgi/Wrapping/ExplicitITK/Modules/Common/wrap_itkTransform.cmake?root=Insight&sortby=date&view=markup
>>
>> Note that I am not even sure that wrap_itkTransform.cmake is the
>> correct file to look at since I have never worked with explicit
>> instantiations within ITK before and since I can't manage to compile
>> ITK with explicit instantiations turned on on my machine.
>>
>> Also it seems that dash13 is not using  explicit instantiations:
>> http://www.cdash.org/CDash/testDetails.php?test=20260566&build=308626
>>
>> Thanks for your help.
>>
>> Tom
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
>


More information about the Insight-developers mailing list