D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4748 - Shadowing declaration error in std.string.tolower
Summary: Shadowing declaration error in std.string.tolower
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-28 19:04 UTC by Jonathan M Davis
Modified: 2010-09-04 08:24 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jonathan M Davis 2010-08-28 19:04:42 UTC
I get the following error when using tolower():

/path/to/src/phobos/std/string.d(775): Error: shadowing declaration std.string.tolower!(immutable(dchar[])).tolower.c is deprecated

/path/tosrc/phobos/std/string.d(887): Error: template instance std.string.tolower!(immutable(dchar[])) error instantiating

datetime.d(6652):        instantiated from here: monthOfYearFromString!(immutable(dchar[]))

unittests.d(67):        instantiated from here: fromSimpleString!(string)

datetime.d(6652): Error: template instance datetime.monthOfYearFromString!(immutable(dchar[])) error instantiating

unittests.d(67):        instantiated from here: fromSimpleString!(string)


tolower appears to be broken with dmd 2.048. Looking at the code, it looks like essentially what's happening in that there's a foreach within a foreach, and they both declare dchar c for the loop variable. Looking at the unit tests, they should have caught this, but either they didn't or the phobos in dmd 2.048 was released without passing all of its unit tests.

In any case, it should be a trivial fix, but it means that if I want to use tolower, I have to patch it on my box, which obviously shouldn't be necessary. At least it should be a quick and obvious fix for anyone with commit prvileges.
Comment 1 David Simcha 2010-09-04 08:24:26 UTC
http://dsource.org/projects/phobos/changeset/1954

Though I still can't figure out for the life of me how this worked before on UTF-8 strings.