llvm-project/clang/test/CXX/drs/dr17xx.cpp

35 lines
884 B
C++

// 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