www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Why this eponymous template does not compile?

reply Victor Porton <porton narod.ru> writes:
///
template sychronizedMemoize(alias fun) {
     void sychronizedMemoize() { }
}

void f() { }

void main()
{
     synchronizedMemoize!f();
}
///

/tmp/temp_7F3C101460D0.d(9,5): Error: template instance 
`synchronizedMemoize!f` template `synchronizedMemoize` is not 
defined, did you mean sychronizedMemoize(alias fun)()?

Why the error? Is it compiler bug? DMD v2.084.1
Mar 25 2019
next sibling parent aliak <something something.com> writes:
On Monday, 25 March 2019 at 09:27:03 UTC, Victor Porton wrote:
 ///
 template sychronizedMemoize(alias fun) {
     void sychronizedMemoize() { }
 }

 void f() { }

 void main()
 {
     synchronizedMemoize!f();
 }
 ///

 /tmp/temp_7F3C101460D0.d(9,5): Error: template instance 
 `synchronizedMemoize!f` template `synchronizedMemoize` is not 
 defined, did you mean sychronizedMemoize(alias fun)()?

 Why the error? Is it compiler bug? DMD v2.084.1
Typo in eponymous template. syc vs sync.
Mar 25 2019
prev sibling parent Bastiaan Veelo <Bastiaan Veelo.net> writes:
On Monday, 25 March 2019 at 09:27:03 UTC, Victor Porton wrote:
 /tmp/temp_7F3C101460D0.d(9,5): Error: template instance 
 `synchronizedMemoize!f` template `synchronizedMemoize` is not 
 defined, did you mean sychronizedMemoize(alias fun)()?

 Why the error?
Sometimes, template error messages are hard to get. But this one is pretty clear, to the point that it is difficult for a human to point out clearer. :o)
Mar 25 2019