﻿id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc
304	Polymorphic self reference does not work	mlbrooks		"{{{
    forall( tE & )
    struct thing {
        thing(tE) *a;
        thing(tE) *b;
    };
}}}

Actual: cfa emits bad code: gcc reports parse errors

Expected: compiles (-c) successfully

Observation:  `cfa -CFA -XCFA,-p` gives the fragment:
{{{
    struct thing {
        struct thing()  *_X1aPS5thing_Y13__tE_generic___1;
        struct thing *_X1bPS5thing_Y13__tE_generic___1;
    };
}}}

Note the field `a` has extra parentheses (bad C syntax)
Note the field `b` is being emitted correctly

The following convoluted sequence of declarations gives a workaround:

{{{
    struct nothing {};
    forall( tE & ) {
        struct nothing_poly {};
        struct thing;
        extern ""C"" {
            nothing xx(nothing_poly(tE)*);  // never defined
            foo(thing(tE)) * not_a_literal();  // never defined
        }
        struct thing{
            typeof(xx(not_a_literal())) shouldBeHarmless;
            thing(tE) *a;
            thing(tE) *b;
        };
    }
}}}
"	defect	new	major	cfa-cc	1.0		polymorphism pointer struct	
