[Issue 12357] New: Untyped string variable fails silently. No compiler warning given.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 13 06:57:03 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12357
Summary: Untyped string variable fails silently. No compiler
warning given.
Product: D
Version: D2
Platform: x86_64
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: dev at nomad.so
--- Comment #0 from Gary Willoughby <dev at nomad.so> 2014-03-13 06:56:55 PDT ---
Rather nasty bug that silently fails. Linux DMD64 D Compiler v2.065
import std.stdio;
import std.array;
import std.conv;
import std.digest.crc;
import std.random;
class Foo
{
public string generateHash()
{
// The following variable is untyped
// yet no compiler error is thrown.
text = Random(unpredictableSeed).front.to!(string);
// text is null here.
return hexDigest!(CRC32)(text).array.to!(string);
}
}
void main(string[] args)
{
auto foo = new Foo();
writefln("%s", foo.generateHash());
}
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list