Bug 2802 – VariantN.opCmp!(T) fails when T != VariantN

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-04-05T14:01:00Z
Last change time
2015-06-09T01:18:03Z
Keywords
patch
Assigned to
andrei
Creator
dsimcha

Attachments

IDFilenameSummaryContent-TypeSize
314Variant.diffPatch to fix bug 2802.text/plain174

Comments

Comment #0 by dsimcha — 2009-04-05T14:01:22Z
import std.stdio, std.variant; void main() { auto v = Variant(1); writeln(v < 1); } Results: E:\dmd\windows\bin\..\..\src\phobos\std\variant.d|634|Error: no property 'type' for type 'int'| E:\dmd\windows\bin\..\..\src\phobos\std\variant.d|634|Error: constructor std.variant.VariantException.this (immutable(char)[] s) does not match parameter types (TypeInfo,int)| E:\dmd\windows\bin\..\..\src\phobos\std\variant.d|634|Error: cannot implicitly convert expression (1) of type int to object.TypeInfo| E:\dmd\windows\bin\..\..\src\phobos\std\variant.d|634|Error: cannot cast int to object.TypeInfo| E:\dmd\windows\bin\..\..\src\phobos\std\variant.d|5|Error: template instance std.variant.VariantN!(maxSize).VariantN.opCmp!(int) error instantiating| The problem is a really simple one-liner. Patch to follow.
Comment #1 by dsimcha — 2009-04-05T14:10:30Z
Created attachment 314 Patch to fix bug 2802. Actually more like a two-liner since I also added a case to the unittest to show that the patch works.
Comment #2 by dsimcha — 2009-12-01T06:21:07Z
Fixed SVN.
Comment #3 by bugzilla — 2009-12-06T00:50:16Z
Fixed dmd 2.037