Thread overview
GDC and DMD incompatability, can both be used?
Jul 11, 2020
cy
Jul 11, 2020
cy
Jul 11, 2020
H. S. Teoh
Jul 11, 2020
Adam D. Ruppe
July 11, 2020
hunt/source/hunt/serialization/JsonSerializer.d:125:20: error: basic type expected, not foreach
  125 |             static foreach (string member; FieldNameTuple!T) {

I'm having a little trouble using the hunt library with gdc. Does gdc not support static foreach at all? Is there some way to write code that it can understand, which does the same thing?
July 11, 2020
And OK yes I see gdc definitely does not support static foreach, but instead there's some sort of D compiler written in D compiled by GDC? That's just dmd, isn't it?

https://github.com/D-Programming-GDC/GDC/pull/550

He calls it "DDMD."
July 10, 2020
On Sat, Jul 11, 2020 at 04:28:32AM +0000, cy via Digitalmars-d-learn wrote:
> hunt/source/hunt/serialization/JsonSerializer.d:125:20: error: basic
> type expected, not foreach
>   125 |             static foreach (string member; FieldNameTuple!T) {
> 
> I'm having a little trouble using the hunt library with gdc. Does gdc not support static foreach at all? Is there some way to write code that it can understand, which does the same thing?

Which version of GDC are you using?  Static foreach is a relatively new feature, and GDC may not have picked it up yet.

GDC uses exactly the same front end as DMD (and LDC), so there is no fundamental incompatibility. The only issue is that GDC is tied to the GCC release cycle, so it may be a few releases behind DMD, and therefore lack some newer features.  Eventually it will catch up, though.


T

-- 
When solving a problem, take care that you do not become part of the problem.
July 11, 2020
On Saturday, 11 July 2020 at 04:28:32 UTC, cy wrote:
>   125 |             static foreach (string member; FieldNameTuple!T) {

The word "static" there can probably be removed and have it work exactly the same way. Worth a try.

> Does gdc not support static foreach at all?

only the newest gdc does, version 10. version 9, in most package managers, doesn't include it.

but if it is inside a function, normal foreach does the same thing anyway.