www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22534] New: ImportC: const pointer (not pointer to const) is


          Issue ID: 22534
           Summary: ImportC: const pointer (not pointer to const) is
                    treated as transitive const
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

A system header on macOS (<sys/_types/_fd_def.h>) actually has an inline
function with a const pointer (not pointer to const). This header is
transitively included by Python.h.

The actual header has a lot of macro expanded junk, but it boils down to a
function that looks like this:

// constp.c
struct S {
    int x;

inline void setit(int i, struct S *const p){
    p->x = i; // constp.c(6): Error: cannot modify `const` expression `(*p).x`

Nov 21 2021