brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 87f71ca Raw
69 lines · cpp
1// RUN: %clang_cc1 -std=c++23 -fsyntax-only -fcxx-exceptions -verify %s2// RUN: %clang_cc1 -std=c++20 -fsyntax-only -fcxx-exceptions -verify %s3// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -verify %s4// expected-no-diagnostics5 6// Throwing7namespace test_throwing {8class Widget {9public:10  Widget(Widget &&);11  Widget(const Widget &) = delete;12};13 14void seven(Widget w) {15  throw w;16}17} // namespace test_throwing18 19// Non-constructor conversion20namespace test_non_constructor_conversion {21class Widget {};22 23struct To {24  operator Widget() const & = delete;25  operator Widget() &&;26};27 28Widget nine() {29  To t;30  return t;31}32} // namespace test_non_constructor_conversion33 34// By-value sinks35namespace test_by_value_sinks {36class Widget {37public:38  Widget();39  Widget(Widget &&);40  Widget(const Widget &) = delete;41};42 43struct Fowl {44  Fowl(Widget);45};46 47Fowl eleven() {48  Widget w;49  return w;50}51} // namespace test_by_value_sinks52 53// Slicing54namespace test_slicing {55class Base {56public:57  Base();58  Base(Base &&);59  Base(Base const &) = delete;60};61 62class Derived : public Base {};63 64Base thirteen() {65  Derived result;66  return result;67}68} // namespace test_slicing69