Re: [eigen] weird template stuff confuses clang |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] weird template stuff confuses clang
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Tue, 6 Jul 2010 00:46:18 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=7J8cEYwl8CCUukuHR/7aKAgW3aMItP8z9eATUTE8qOA=; b=wblzNHmVVztGyty2xgp1CzxsUmrTyti5KszDA98POqYQWJ5vam+zk/r++TX8GjYblr aqur8kiobCww660yXc3UQvm43ADiLZmN90qbbcHkszrsvubpF6TWSRfie+KSBWUop54X nCB8bdvP8BmJYqF2jx1B1dtycGhzkH1iiFJpE=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=EDsJrtNUbVeEpiPRy4xH+KC1ocZRWmb4m6UxhC0U98NE7rUVZ8SNtwIGvADNOS7eWM LXq+EC8zD64j45aIn3GdCmRq2V9WlfuYRsDdzmjeRt5cIt6J5iKzavcVJTtbAJWvi/1v +f2cUDiCGR1ux1kNqe7TubNd3XgUy9wHgHxJA=
That's called "template template parameters". They're part of c++98
and have been supported by major compilers for a while. Clang++ is
still young, I'm sure it will support them soon!
http://www.informit.com/articles/article.aspx?p=376878
http://stackoverflow.com/questions/213761/what-are-some-uses-of-template-template-parameters-in-c
Since you have a clang crash, I'm sure that if you report it to clang
devs, they'll take care of it. Try to figure how to generate the
preprocessed source with clang so you can give them a self-contained
test case.
Benoit
2010/7/5 Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>:
>
> Hello,
>
> I have one last thing to fix to get clang compiles eigen again. I'm kinda lost, so here are the details. First, note that eigen used to compile with clang, until commit 82bf6ba3c9d5 by gael. The interesting file is Eigen/src/Core/VectorwiseOp.h
>
> This commit changes the signature of ReturnType (line ~170) from
> template<template<typename _Scalar> class Functor> struct ReturnType;
> to
> template<template<typename _Scalar> class Functor, typename Scalar=typename ei_traits<ExpressionType>::Scalar> struct ReturnType;
>
> And this is where clang crashes (it actually crashes, signal11).
> If i revert the patch, it compiles again. Starting from such a state. We have then
> template<template<typename _Scalar> class Functor> struct ReturnType;
>
> If i change this to
> template<template<typename _Scalar> class Functor, typename asdf> struct ReturnType;
> it crashes again
>
> If instead I do
> template<template<typename> class Functor, typename afefScalar=int > struct ReturnType
> it compiles ok but... this one fails again:
> template<template<typename> class Functor, typename afefScalar= typename ei_traits<ExpressionType>::Scalar > struct ReturnType
>
>
> From there i dont know. At first i thought it was just a clang bug... but now i'm not sure.
>
> As a side note (but this is unrelated), the same name 'Scalar' is used to define a typedef in the class and as template name for ReturnType, which is kind unfortunate i guess.
>
> If you have any idea.
> Thomas
> --
> Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>
> http://www.freehackers.org/thomas
>
>
>