www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17350] New: bitmanip checks min, while Ternary does not have


          Issue ID: 17350
           Summary: bitmanip checks min, while Ternary does not have this
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: sascha.orlov gmail.com

Trying this 

import std.bitmanip; 
import std.typecons; 
void main(){}

struct S1
    Val*, "vv",
    bool, "b1", 1,
    bool, "b2", 1,
    bool, "b3", 1));

struct S2
    Val*, "vv",
    ubyte, "t", 3));

struct S3
    Val*, "vv",
    Ternary, "t", 3));

struct Val
    size_t dummy; 

I got an error: 
bitmanip.d(94,20): Error: no property 'min' for type 'Ternary'
bitmanip.d(127,20): Error: no property 'min' for type 'Ternary'
bitmanip.d(183,15): Error: template instance
std.bitmanip.createAccessors!("_vv_t", Ternary, "t", 3LU, 0LU) error
bitmanip.d(243,11): instantiated from here: createFields!("_vv_t", 0LU,
Ternary, "t", 3, ulong, "", 61LU)
bitmanip.d(314,26): instantiated from here: createTaggedReference!(Val*, 8LU,
"vv", Ternary, "t", 3)
test62.d(17,8): instantiated from here: taggedPointer!(Val*, "vv", Ternary,
"t", 3)

I understand, that it is not possible to order a Ternary without
implifications. However, as the size allows it, it should be possible to use it
as a pointer discriminator.

Apr 26 2017