www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - =?UTF-8?B?W0lzc3VlIDIyNzI4XSBOZXc6IGltcG9ydEM6IGVycm9yOiBlbnVt?=

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

          Issue ID: 22728
           Summary: importC: error: enum has no members when compiling
                    typedef’d enum.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

Encountered this when trying to compile sqlite:

// repo.c
typedef enum task_role { // repo.c(2): Error: `enum task_role` has no members
 TASK_RENICED = -1,
 TASK_UNSPECIFIED = 0,
 TASK_FOREGROUND_APPLICATION = 1,
 TASK_BACKGROUND_APPLICATION = 2,
 TASK_CONTROL_APPLICATION = 3,
 TASK_GRAPHICS_SERVER = 4,
 TASK_THROTTLE_APPLICATION = 5,
 TASK_NONUI_APPLICATION = 6,
 TASK_DEFAULT_APPLICATION = 7,
 TASK_DARWINBG_APPLICATION = 8,
} task_role_t;

If it’s a regular enum declaration instead of a typedef there is no error.

--
Feb 02 2022