This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82763] New: std::is_pod works incorrectly with volatile


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82763

            Bug ID: 82763
           Summary: std::is_pod works incorrectly with volatile
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jpakkane at gmail dot com
  Target Milestone: ---

The following program prints "is_pod 1":

#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;
}

However Clang prints "is_pod 0". Originally this was filed as a bug in Clang
here:

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

However that bug has a long explanation on why Clang is doing the right thing
and that Gcc behaves incorrectly.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]