www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24626] New: hasUDA does not handle multiple UDAs of the same

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

          Issue ID: 24626
           Summary: hasUDA does not handle multiple UDAs of the same
                    symbol
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: trivial
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: kduice qq.com

This code fails to compile with ldc 1.38.0

import core.internal.traits : hasUDA;

enum SomeUDA;

struct Test
{
    int woUDA;
     SomeUDA int oneUDA;
     SomeUDA  SomeUDA int twoUDAs;
}

static assert(hasUDA!(Test.oneUDA, SomeUDA));
static assert(hasUDA!(Test.twoUDAs, SomeUDA));
static assert(!hasUDA!(Test.woUDA, SomeUDA));

Error message:
Error: variable `test.Test.hasUDA!(twoUDAs, SomeUDA).__anonymous.hasUDA`
conflicts with variable `test.Test.hasUDA!(twoUDAs, SomeUDA).hasUDA` at
/opt/homebrew/Cellar/ldc/1.38.0/include/dlang/ldc/core/internal/traits.d(818)
test.d(13): Error: template instance `test.Test.hasUDA!(twoUDAs, SomeUDA)`
error instantiating
test.d(13):        while evaluating: `static assert(hasUDA!(twoUDAs, SomeUDA))`

--
Jun 23