www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24475] New: ImportC: allow _Alignof expression

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

          Issue ID: 24475
           Summary: ImportC: allow _Alignof expression
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

C standard only defines:

  _Alignof ( type-name )

whereas sizeof is defined as:

  sizeof unary-expression 
  sizeof ( type-name )

However, gcc and clang also accept

  _Alignof unary-expression

with the obvious semantics of an implicit typeof on the unary-expression, in
the same manner as sizeof.

I’ve encountered this in some code.

--
Mar 31