Thread overview
[Issue 12576] problem with compile time struct field
Apr 20, 2014
Ellery Newcomer
Apr 21, 2014
Kenji Hara
Apr 22, 2014
Ellery Newcomer
Jul 08, 2020
Simen Kjaeraas
April 20, 2014
https://issues.dlang.org/show_bug.cgi?id=12576

Ellery Newcomer <ellery-newcomer@utulsa.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal

--
April 21, 2014
https://issues.dlang.org/show_bug.cgi?id=12576

--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> ---
Is this a possible workaround for your 'original' code? I'm not sure it's the actual issue, because the code still fail to compile.

template Replace(string base, T...)
{
    template NextAt(string base, string longest_spec,
            size_t _at0, T...)
    {
    }

    NextAt!(base,"",-1,T) N;
}

struct _CppFunction {
    string funcname;
}

string CppClass1(string name, Clazz)()
{
    enum _CppFunction cf = {
    };
    enum x = cf.funcname;    // <--- workaround?
    enum mix = Replace!("
        ReturnType Func(Params) {
            return Mangled(args);
        }\n",
        "Func", /*cf.funcname*/x);   // <--- workaround?
    return mix;
}

enum Mixins = CppClass1!("X", typeof(new class { }));

--
April 22, 2014
https://issues.dlang.org/show_bug.cgi?id=12576

--- Comment #2 from Ellery Newcomer <ellery-newcomer@utulsa.edu> ---
yeah, that's what I do now, so this one is probably not the highest priority

--
July 08, 2020
https://issues.dlang.org/show_bug.cgi?id=12576

Simen Kjaeraas <simen.kjaras@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |simen.kjaras@gmail.com
         Resolution|---                         |FIXED

--- Comment #3 from Simen Kjaeraas <simen.kjaras@gmail.com> ---
While the code in these examples don't compile today, that appears to be because it's incomplete. The underlying issue 5710 has been fixed.

--