static foreach declaration already defined

Ssenni ssenni at gmail.com
Thu Aug 27 09:40:15 UTC 2026


How can I get around this?

```
struct Foo(T) {

   static foreach (m; __traits(derivedMembers, T)) {
     static foreach (i, method; __traits(getOverloads, T, m)) {
       static if (is(typeof(method) Params == __parameters)) {
       }
     }
   }
}
```

Error: declaration `Params` is already defined here.

If I recall, there used to be a trick for static foreach using 
double braces, but the compiler complains "declaration expected 
not {".




More information about the Digitalmars-d-learn mailing list