www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17145] New: Tuple expansion does not work in local enum

https://issues.dlang.org/show_bug.cgi?id=17145

          Issue ID: 17145
           Summary: Tuple expansion does not work in local enum
                    declaration
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: CTFE, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: epi atari8.info

import std.typecons : tuple;

enum foo = tuple(1, 2).expand; // Compiles up to 2.071.2 and with PR #6517
pragma(msg, typeof(foo).stringof);
pragma(msg, foo.stringof);

void bar()
{
    auto roo = tuple(1, 2).expand; // OK
    pragma(msg, typeof(roo).stringof);
    pragma(msg, roo.stringof);
}

void baz()
{
    enum zoo = tuple(1, 2).expand; // Error: value of __tup1847 is not known at
compile time
    pragma(msg, typeof(zoo).stringof);
    pragma(msg, zoo.stringof);
}

--
Feb 04