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: unassignedclangb...@nondot.org
          Reporter: joseph.n...@live.com
                CC: dgre...@apple.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to