aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Parser/cxx-bad-cast-diagnose-broken-template.cpp
blob: 3500975d936953dbc69b0dab298bb5f73e8e504c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s

template<typename>
struct StringTrait {};

template< int N >
struct StringTrait< const char[ N ] > {
  typedef char CharType;
  static const MissingIntT length = N - 1; // expected-error {{unknown type name 'MissingIntT'}}
};

class String {
public:
  template <typename T>
  String(T& str, typename StringTrait<T>::CharType = 0);
};


class Exception {
public:
  Exception(String const&);
};

void foo() {
  throw Exception("some error"); // expected-error {{functional-style cast from 'const char[11]' to 'Exception' is not allowed}}
}