[llvm-bugs] [Bug 35076] New: std::is_pod weirdly affected by volatile
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Oct 25 11:30:13 PDT 2017
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: unassignedclangbugs at nondot.org
Reporter: jpakkane at gmail.com
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171025/742b9bda/attachment.html>
More information about the llvm-bugs
mailing list