[Issue 20565] Local template function in static foreach yields link error LNK1179 on fresh compile

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 3 09:52:34 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=20565

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid

--- Comment #4 from Walter Bright <bugzilla at digitalmars.com> ---
Rewriting the bug example with functions instead of templates, an error is
correctly generated:

  void main()
  {
    {
        int temp() { return 3; }

        temp();
    }

    {
        int temp() { return 4; }

        temp(); // Error: declaration test.main.temp is already defined in
another scope in main at line 6
    }
  }

This suggests the obvious fix of extending the check for functions to include
template functions.

--


More information about the Digitalmars-d-bugs mailing list