www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22938] New: ImportC: __import modules and their typedefs

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

          Issue ID: 22938
           Summary: ImportC: __import modules and their typedefs
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

The addition of a symbol table of typedefs to ImportC compilation raises a
problem with imported files - the imported typedefs will be invisible during
the parse.

The solution is when an __import is seen, the current C compilation should be
paused while the imported file is parsed. The typedef symbol table thus
generated should then be made available to the importer.

What to do about typedefs from imported D modules is a bit trickier. The
workaround would be for the C importer to redeclare the typedef. Another
possibility is to add a __cast keyword to distinguish cast expressions. (Or
maybe support C++'s static_cast instead.)

--
Mar 25 2022