brintos

brintos / llvm-project-archived public Read only

0
0
Text · 613 B · 3500975 Raw
27 lines · cpp
1// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s2 3template<typename>4struct StringTrait {};5 6template< int N >7struct StringTrait< const char[ N ] > {8  typedef char CharType;9  static const MissingIntT length = N - 1; // expected-error {{unknown type name 'MissingIntT'}}10};11 12class String {13public:14  template <typename T>15  String(T& str, typename StringTrait<T>::CharType = 0);16};17 18 19class Exception {20public:21  Exception(String const&);22};23 24void foo() {25  throw Exception("some error"); // expected-error {{functional-style cast from 'const char[11]' to 'Exception' is not allowed}}26}27