diff options
Diffstat (limited to 'test/CXX/drs/dr17xx.cpp')
-rw-r--r-- | test/CXX/drs/dr17xx.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/CXX/drs/dr17xx.cpp b/test/CXX/drs/dr17xx.cpp new file mode 100644 index 000000000000..1ab8c40d3972 --- /dev/null +++ b/test/CXX/drs/dr17xx.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors + +// expected-no-diagnostics + +#if __cplusplus >= 201103L +namespace dr1756 { // dr1756: 3.7 c++11 + // Direct-list-initialization of a non-class object + + int a{0}; + + struct X { operator int(); } x; + int b{x}; +} // dr1756 + +namespace dr1758 { // dr1758: 3.7 c++11 + // Explicit conversion in copy/move list initialization + + struct X { X(); }; + struct Y { explicit operator X(); } y; + X x{y}; + + struct A { + A() {} + A(const A &) {} + }; + struct B { + operator A() { return A(); } + } b; + A a{b}; +} // dr1758 +#endif |