Extracting user defined attributes on function parameters

Simen Kjærås simen.kjaras at gmail.com
Sat Apr 18 09:37:53 UTC 2020


On Saturday, 18 April 2020 at 09:19:48 UTC, Simen Kjærås wrote:
> On Wednesday, Friday, 17 Apr 2020 17:45:47 UTC, H. S. Teoh 
> wrote:
>
>> I wonder if the ultimate cause of the above case is ultimately 
>> caused by
>> the change to import semantics that hid private symbols from 
>> outside the
>> module. Perhaps something, somewhere, is triggering an illegal 
>> access of
>> a private symbol, which percolates up the call/instantiation 
>> stack and
>> causing what appears to be a strange compiler discrepancy.
>
> Not unlikely. Importing the module defining S in the module 
> defining ParameterDefaults does indeed make things compile. 
> Hiding S by making it private makes the error return.

It's not about private. Or even if it is, there's other issues. 
Proof:

struct A {
     struct S {}
     void f(@S int = 3);
     pragma(msg, Issue20744!f);
}

template Issue20744(func...) {
     static if (is(typeof(func[0]) PT == __parameters)) {
         alias Issue20744 = (PT args) {};
     }
}

--
   Simen


More information about the Digitalmars-d-learn mailing list