[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-bugs
Subject: [Bug c++/81634] New: Some types are incorrectly detected as not standard layout
From: "raskolnikov at gnu dot org" <gcc-bugzilla () gcc ! gnu ! org>
Date: 2017-07-31 15:29:57
Message-ID: bug-81634-4 () http ! gcc ! gnu ! org/bugzilla/
[Download RAW message or body]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81634
Bug ID: 81634
Summary: Some types are incorrectly detected as not standard
layout
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: raskolnikov at gnu dot org
Target Milestone: ---
The following code fails to compile with GCC 7.1.0 when passing -std=c++17:
```
#include <type_traits>
struct a {};
struct b { int x; };
struct ca : a {};
struct cb : ca { b x; };
static_assert(std::is_standard_layout<cb>::value, "");
```
https://wandbox.org/permlink/DjuHERFFvgJg84ub
Instead of using `is_standard_layout`, we can detect the bug by using
`offsetof(cb, b)`, which incorrectly rises a warning about `cb` not being
standard layout.
It does work as expected, with -std=c++14 or with other versions of GCC.=
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic