[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / cxx-bad-cast-diagnose-broken-template.cpp
blob3500975d936953dbc69b0dab298bb5f73e8e504c
1 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
3 template<typename>
4 struct StringTrait {};
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'}}
12 class String {
13 public:
14 template <typename T>
15 String(T& str, typename StringTrait<T>::CharType = 0);
19 class Exception {
20 public:
21 Exception(String const&);
24 void foo() {
25 throw Exception("some error"); // expected-error {{functional-style cast from 'const char[11]' to 'Exception' is not allowed}}