www.digitalmars.com         C & C++   DMDScript  

D - Bug in dmd

reply Matthias Becker <Matthias_member pathlink.com> writes:
I tried to compile the following code (I just wanted to experiment a bit with
the new template-abilitys, but I get the following:

Assertion failure: '0' on line 67 in file 'template.c'

abnormal program termination


The code is:

/* C++

template <typename T>
struct Foo {
typedef T Type;

template <typename U>
struct Inner {
typedef U Type;
};
};

template <template <typename> class TT>
struct Bar {
typedef typename TT<int>::Type A;
typedef typename TT<int>::template Inner<A>::Type B;
};

int main(int argc, char *argv[])
{
Bar<Foo>::A x;
Bar<Foo>::B y;
}

*/

class Foo (T) {
typedef T Type;

class Inner (U) {
typedef U Type;
};
};

struct Bar (alias TT) {
typedef TT!(int).Type A;
typedef TT!(int).Inner!(A).Type B;

};

int main (char [][] args)
{
Bar!(Foo).A x;
Bar!(Foo).B y;

return 0;
}
Jan 19 2004
parent "Sean L. Palmer" <palmer.sean verizon.net> writes:
WTF!!?!!  Is that even legit C++ code?!!  I have never seen such a thing.
I'm going to have to try that.

VC++ 7.0 doesn't seem to like it.

Sean

"Matthias Becker" <Matthias_member pathlink.com> wrote in message
news:buh7uu$28mh$1 digitaldaemon.com...
 I tried to compile the following code (I just wanted to experiment a bit
with
 the new template-abilitys, but I get the following:

 Assertion failure: '0' on line 67 in file 'template.c'

 abnormal program termination


 The code is:

 /* C++

 template <typename T>
 struct Foo {
 typedef T Type;

 template <typename U>
 struct Inner {
 typedef U Type;
 };
 };

 template <template <typename> class TT>
 struct Bar {
 typedef typename TT<int>::Type A;
 typedef typename TT<int>::template Inner<A>::Type B;
 };

 int main(int argc, char *argv[])
 {
 Bar<Foo>::A x;
 Bar<Foo>::B y;
 }

 */

 class Foo (T) {
 typedef T Type;

 class Inner (U) {
 typedef U Type;
 };
 };

 struct Bar (alias TT) {
 typedef TT!(int).Type A;
 typedef TT!(int).Inner!(A).Type B;

 };

 int main (char [][] args)
 {
 Bar!(Foo).A x;
 Bar!(Foo).B y;

 return 0;
 }
Jan 21 2004