https://bugs.llvm.org/show_bug.cgi?id=36050

            Bug ID: 36050
           Summary: Suspected bug on nested union type-punning
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: chen.pang...@jdh8.org
                CC: llvm-bugs@lists.llvm.org

#define reinterpret(T, x) ((union { __typeof__(x) from; T to; }){ x }.to)

float fail(float x)
{
    // error: initializer element is not a compile-time constant
    return reinterpret(float, reinterpret(int, x) | 0x7FC00000);
}

float pass(float x)
{
    unsigned i = reinterpret(int, x);

    return reinterpret(int, i | 0x7FC00000);
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to