www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20653] New: Short-circuiting boolean logic not working

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

          Issue ID: 20653
           Summary: Short-circuiting boolean logic not working
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: turkeyman gmail.com

I feel like this should work:

enum Thing { A, B }
enum IsThing(T) = is(T == enum) || (__traits(getLinkage, T) == "C++");
enum Is = IsThing!Thing;

 Error: argument to `__traits(getLinkage, Thing)` is not a declaration
 Error: template instance `IsThing!(Thing)` error instantiating
`is(T == enum)` is true, so it shouldn't attempt to evaluate `getLinkage`. --
Mar 09