alias template parameters - opCall caller! example breaks in Programming in D, page 530

Nick Treleaven nick at geany.org
Sat Aug 23 13:38:27 UTC 2025


On Saturday, 23 August 2025 at 12:50:40 UTC, Brother Bill wrote:
> On page 530 of Programming in D, we have this code snippet:

What section of the book?

> Compiled with DMD yielding error messages:
> ```
> c:\dev\D\71 - 
> 80\c78_3k_alias_template_opCall_overload\source\app.d(5): 
> Error: template instance `caller!o` template `caller` is not 
> defined
>     caller!o();
>     ^
> c:\dev\D\71 - 
> 80\c78_3k_alias_template_opCall_overload\source\app.d(7): 
> Error: template instance `caller!(()
> {
> writeln("Function literal called.");
> }
> )` template `caller` is not defined
>     caller!({ writeln("Function literal called."); })();
>     ^
> ```
>
> What is needed to get this code to compile?
> My only idea is that a #import statement is missing.

I'm not aware of any template function called `caller` - perhaps 
it is defined in the book somewhere?


More information about the Digitalmars-d-learn mailing list