| |
|
J Anderson
Posted in reply to Carlos Santander B.
| Alot of 2567 errors coming up recently. This has been broken since .89. It's dam annoying when your project just breaks for no good reason.
Your workaround is served cold:
Well I got this much working:
template CT (T1, T2) //Took out the cmp - note this doesn't effect the intenal bug
{
class C : S
{
}
}
class C1 (T)
{
}
class C2 (T)
{
}
template T2 ( T )
{
alias .CT CCT; //The workaround - Prevents internal error
alias CCT!(C1!(T), C2!(T)).C S;
class C : S
{
}
}
void main()
{
T2!(int).C t;
Carlos Santander B. wrote:
>In
>http://msdn.microsoft.com/visualc/using/understanding/perf/default.aspx?pull=/library/en-us/dv_vstechart/html/boostvc.asp, I
>found this piece of C++ code:
>
>template< typename T >
>class auto_size_example
> : private mpl::if_< sizeof(T) <= sizeof(double)
> , stack_implementation<T>
> , heap_implementation<T>
> >::type
>{
> // ...
>};
>
>I thought, this can also be done in D, so I tried to. I figured this could
>be the way:
>
>template CT (alias cmp, T1, T2)
>{
> version (cmp)
> alias T1 S;
> else
> alias T2 S;
>
> class C : S
> {
> }
>}
>
>class C1 (T)
>{
>}
>
>class C2 (T)
>{
>}
>
>template T2 ( T )
>{
> class C : CT!( T.size < double.size , C1!(T), C2!(T) ).C
> {
> }
>}
>
>void main()
>{
> T2!(int).C t;
>}
>
>However I get "template instance CT!(1,C1 ,C2 ) does not match any template
>declaration" (again, no line number, no nothing).
>DMD wouldn't let me write "class C : .CT..." (notice the dot before CT), so
>I decided to rewrite T2 as:
>
>template T2 ( T )
>{
> alias .CT!( T.size < double.size , C1!(T), C2!(T) ).C S;
>
> class C : S
> {
> }
>}
>
>But then I got the horrible:
>"Assertion failure: 'id->dyncast() == DYNCAST_IDENTIFIER' on line 2567 in
>file 'mtype.c'
>
>abnormal program termination"
>
>-----------------------
>Carlos Santander Bernal
>
>
>
>
--
-Anderson: http://badmama.com.au/~anderson/
|