www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - isNumeric bugfix or 2.072 regression?

reply Johan Engelen <j j.nl> writes:
Hi all,

`isNumeric!string` no longer works like it did in 2.071 when both 
std.string and std.traits are imported.

   This code no longer compiles with 2.072:

```d
// RUN: dmd -c test.d
import std.string;
import std.traits;

void foo()
{
     static if (isNumeric!string) {}
}
```

The error is (dlang 2.072 and 2.073):
isnum.d(6): Error: std.traits.isNumeric(T) at 
/Library/D/dmd/src/phobos/std/traits.d(5350) conflicts with 
std.string.isNumeric(S)(S s, bool bAllowSep = false) if 
(isSomeString!S || isRandomAccessRange!S && hasSlicing!S && 
isSomeChar!(ElementType!S) && !isInfinite!S) at 
/Library/D/dmd/src/phobos/std/string.d(5844)

dlang 2.070 and 2.071 compile it fine.
Is this part of fixing import issues and the above code is just 
broken, or is it a bug?

- Johan
Feb 16 2017
parent Johan Engelen <j j.nl> writes:
On Thursday, 16 February 2017 at 23:15:09 UTC, Johan Engelen 
wrote:
 Hi all,

 `isNumeric!string` no longer works like it did in 2.071 when 
 both std.string and std.traits are imported.
https://issues.dlang.org/show_bug.cgi?id=17190
Feb 16 2017