How to iterate getSymbolsByUDA

Steven Schveighoffer schveiguy at gmail.com
Mon Nov 26 16:30:38 UTC 2018


On 11/26/18 8:59 AM, Adam D. Ruppe wrote:
> On Monday, 26 November 2018 at 13:50:13 UTC, Eko Wahyudin wrote:
>> seems my problem is i use GDC, i got this error
>>
>> error: basic type expected, not foreach.
> 
> The common versions of gdc don't support static foreach, but plain 
> foreach should work there the same way in this context.
> 
> So just remove the word "static" and try it then.

Yeah, the original code used for, not foreach. for does not work on 
compile-time alias sequences (which is what getSymbolsByUDA evaluates 
to). Using foreach should work with most flavors of the compiler.

static foreach was a recent addition to D, so I expect GDC will be 
getting support for it eventually.

-Steve


More information about the Digitalmars-d-learn mailing list