Debian Codegraph @

clang/test/Parser/cxx-bad-cast-diagnose-broken-template.cpp

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