www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12892] New: extern(C): label confined to version scope


          Issue ID: 12892
           Summary: extern(C): label confined to version scope
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: markisaa umich.edu

If I write:

version(Win32) {
} else {

Then the functions below this version block are unaffected. In particular, the
extern does not apply to anything after the close curly. This also happens if I
remove the curly braces from that code. If I just do:


without any version block, everything works fine. Similarly, if I do:

version(Win32) {
  enum isWin32 = true;
} else {
  enum isWin32 = false;

static if (isWin32) {
} else {

Then it also does *not* work as expected. The extern label does not go beyond
the close curly.

If I remove the curly braces from the static if part of that, I get:
$ dmd cversion.d cversion.def odbcinst.d sqlucode.d sqlext.d sql.d sqltypes.d
-m64 -shared
cversion.d(44): Error: Declaration expected, not 'else'
cversion.d(59): Error: Declaration expected, not 'if'
cversion.d(67): Error: Declaration expected, not 'if'
cversion.d(73): Error: no identifier for declarator szConnStrOut[cbConnStrOut -
cversion.d(73): Error: Declaration expected, not '='
cversion.d(74): Error: unrecognized declaration

Jun 11 2014