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

            Bug ID: 35076
           Summary: std::is_pod weirdly affected by volatile
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: jpakk...@gmail.com
                CC: llvm-bugs@lists.llvm.org

If you compile the following code with Clang:

#include <iostream>
#include <type_traits>
#include <cstdint>

typedef struct
{
    int64_t dt_us;
} __attribute__ ((packed)) mytime_t ;

struct MyTimeDate
{
    volatile mytime_t mytime;
};

int main(int argc, const char *argv[])
{
    std::cout << "is_pod " << std::is_pod<MyTimeDate>::value << std::endl;
    return 0;
}

It will print "is_pod 0". If you move the volatile to the upper definition like
this:

typedef struct
{
    volatile int64_t dt_us;
} __attribute__ ((packed)) mytime_t ;

struct MyTimeDate
{
    mytime_t mytime;
};

Then it will print "is_pod 1". The same code on GCC prints "is_pod 1" for both
programs.

Tested on Ubuntu 17/04.

-- 
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