[llvm-bugs] [Bug 26043] New: volatile members cause PODs to be a non-literal type

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 6 08:44:48 PST 2016


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

            Bug ID: 26043
           Summary: volatile members cause PODs to be a non-literal type
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: joseph.noir at live.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Here is a minimal example compiled with Apple LLVM version 7.0.2
(clang-700.1.81) on OS X 10.11.

extern "C" {
typedef struct foo {
  volatile int a;
} foo;
typedef struct bar {
  foo f;
} bar;
} // extern "C"


class baz {
public:
  constexpr baz() : bar_({0}) {}
  bar bar_;
};

int main() {
  // nop
}

>From my understanding of the standard this should be work I get the following
error:

main.cpp:14:13: error: constexpr constructor never produces a constant
expression [-Winvalid-constexpr]
  constexpr baz() : bar_({0}) {}
            ^
main.cpp:14:21: note: non-literal type 'bar' cannot be used in a constant
expression
  constexpr baz() : bar_({0}) {}
                    ^
1 error generated.

-- 
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/20160106/25399120/attachment.html>


More information about the llvm-bugs mailing list