www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18990] New: Failing class instantiations ignored in UDAs


          Issue ID: 18990
           Summary: Failing class instantiations ignored in UDAs
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: simen.kjaras gmail.com

This compiles without error:

struct Attr
    A h;

 Attr(new A(3)) // Line 6
class A {}

static assert(!__traits(compiles, new A(3)));

Clearly, line 6 should fail, since new A(3) doesn't compile elsewhere.

This issue seems to cause problem with std.traits.getSymbolsByUDA:

import std.traits;
static assert(!getSymbolsByUDA!(mixin(__MODULE__), Attr).length);
static assert(hasUDA!(A, Attr));

clearly, if hasUDA is true, then getSymbolsByUDA should return that symbol, but
it doesn't. This could be a separate issue, but I'm not sure.

Jun 15 2018