[llvm-bugs] [Bug 34683] New: [Regression] C++03 and lower fails to compile a union with a volatile struct that has a volatile struct filed

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 20 04:18:01 PDT 2017


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

            Bug ID: 34683
           Summary: [Regression] C++03 and lower fails to compile a union
                    with a volatile struct that has a volatile struct
                    filed
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arphaman at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The following code fails to compile with LLVM 5 and above (with -std=C++03 or
less):

```
typedef unsigned short uint16;
typedef unsigned int uint32;

typedef volatile struct {
  uint16  field;
} t1;

typedef volatile struct {
  t1  a;
} t2;

typedef volatile union {
  t2  b;
} t3;
```

Clang reports the following error:

```
test.cpp:13:7: error: union member 'b' has a non-trivial copy constructor
  t2  b;
      ^
test.cpp:9:7: note: because no constructor can be used to copy field of type
'const t1' (aka 'const volatile
      (anonymous struct at test.cpp:4:18)')
  t1  a;
      ^
1 error generated.
```

This is a new regression caused by r310983.

-- 
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/20170920/a83a98a4/attachment.html>


More information about the llvm-bugs mailing list