brintos

brintos / llvm-project-archived public Read only

0
0
Text · 936 B · 89cae03 Raw
32 lines · cpp
1// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -std=c++11 -verify %s2 3template<typename T> struct TryCatch0 {4  void f() {5    try {6    } catch (T&&) { // expected-error 2{{cannot catch exceptions by rvalue reference}}7    }8  }9};10 11template struct TryCatch0<int&>; // okay12template struct TryCatch0<int&&>; // expected-note{{instantiation}}13template struct TryCatch0<int>; // expected-note{{instantiation}}14 15 16namespace PR10232 {17  template <typename T>18  class Templated {19    struct Exception {20    private:21      Exception(const Exception&); // expected-note{{declared private here}}22    };23    void exception() {24      try {25      } catch(Exception e) {  // expected-error{{calling a private constructor of class 'PR10232::Templated<int>::Exception'}}26      }27    }28  };29 30  template class Templated<int>; // expected-note{{in instantiation of member function 'PR10232::Templated<int>::exception' requested here}}31}32