February 24, 2021
https://issues.dlang.org/show_bug.cgi?id=21662

          Issue ID: 21662
           Summary: Extern linkage variables cannot be of types with
                    disabled default construction
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: n8sh.secondary@hotmail.com

The real-world place where this got in the way was trying to use `extern(C++) extern __gshared core.stdcpp.basic_string!char` to refer to a variable of type std::string defined in a C++ library. The problem is not specific to C++ compatibility however.

Example:

---
struct S { @disable this(); }
extern __gshared S someVal;
void main() {}
---
Error: variable onlineapp.someVal default construction is disabled for type S

Can we fix this by giving `someVal` a void initializer? No.

---
struct S { @disable this(); }
extern __gshared S someVal = void;
void main() {}
---
Error: variable onlineapp.someVal extern symbols cannot have initializers

Changing `void` to `S.init` or removing `__gshared` does not change the error message.

--