Created attachment 1019 [details] a testcase for compiling a static synchronized method seems related to issue 5664, but not as trivial a fix. attached code show how a normal static synchronized method compiles just fine, but a templated version fails.
@SSoulaimane updated dlang/dmd pull request #9647 "Make `toParentDecl()` follow the declaration scope even for static templates" fixing this issue: - Close issue 6541 https://github.com/dlang/dmd/pull/9647
dlang/dmd pull request #9647 "Move `toParentDecl` to `toParentLocal` and make a new `toParentDecl()` which follows the declaration scope even for static templates" was merged into master: - 5a59d3b441ceeaf33ad06cb0069d5b910f411eb0 by سليمان السهمي (Suleyman Sahmi): Close issue 6541 https://github.com/dlang/dmd/pull/9647