Special enum names are used to represent types that do not have an
equivalent basic D type. For example, C++ types used by the C++ name mangler.
Special enums are declared opaque, with a base type explicitly set. Unlike
regular opaque enums, special enums can be used as any other value type. They
have a default .init value, as well as other enum properties available
(.min, .max). Special enums can be declared in any module, and
will be recognized by the compiler.
import gcc.builtins; enum __c_long : __builtin_clong; __c_long var = 0x800A;
The following identifiers are recognized by GNU D.
__c_complex_doubleC _Complex double type.
__c_complex_floatC _Complex float type.
__c_complex_realC _Complex long double type.
__c_longC++ long type.
__c_longlongC++ long long type.
__c_long_doubleC long double type.
__c_ulongC++ unsigned long type.
__c_ulonglongC++ unsigned long long type.
__c_wchar_tC++ wchar_t type.
The core.stdc.config module declares the following shorthand alias types
for convenience: c_complex_double, c_complex_float,
c_complex_real, cpp_long, cpp_longlong,
c_long_double, cpp_ulong, cpp_ulonglong.
It may cause undefined behavior at runtime if a special enum is declared with a base type that has a different size to the target C/C++ type it is representing. The GNU D compiler will catch such declarations and emit a warning when the -Wmismatched-special-enum option is seen on the command-line.