Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaTemplate / instantiate-incomplete-typo-suggested-error-limit.cpp
blob7f02b458fed725573aa47fec8fdcf23bb4282483
1 // RUN: not %clang -fsyntax-only -std=c++11 -ferror-limit=1 %s 2>&1 | FileCheck %s
3 // Test case for PR35682.
4 // The issue be caused by the typo correction that changes String to the
5 // incomplete type string. The example is based on the std::pair code and
6 // reduced to a minimal test case. When using std::pair the issue can only be
7 // reproduced when using the -stdlib=libc++ compiler option.
9 template <class T> class allocator;
11 template <class charT> struct char_traits;
13 template <class CharT, class Traits = char_traits<CharT>,
14 class Allocator = allocator<CharT>>
15 class basic_string;
16 typedef basic_string<char, char_traits<char>, allocator<char>> string;
18 template <bool, class Tp = void> struct enable_if {};
19 template <class Tp> struct enable_if<true, Tp> { typedef Tp type; };
21 template <class Tp, Tp v> struct integral_constant {
22 static constexpr const Tp value = v;
23 typedef Tp value_type;
24 typedef integral_constant type;
26 constexpr operator value_type() const noexcept { return value; }
27 constexpr value_type operator()() const noexcept { return value; }
30 template <class Tp, Tp v> constexpr const Tp integral_constant<Tp, v>::value;
32 using true_type = integral_constant<bool, true>;
33 using false_type = integral_constant<bool, false>;
35 template <class Tp, class Up> struct is_same : public false_type {};
36 template <class Tp> struct is_same<Tp, Tp> : public true_type {};
38 template <class T> struct single {
39 typedef T first_type;
41 T first;
43 struct CheckArgs {
44 template <class U1> static constexpr bool enable_implicit() {
45 return is_same<first_type, U1>::value;
49 template <class U1,
50 typename enable_if<CheckArgs::template enable_implicit<U1>(),
51 bool>::type = false>
52 single(U1 &&u1);
55 using SetKeyType = String;
56 single<SetKeyType> v;
58 // CHECK: error: unknown type name 'String'; did you mean 'string'?
59 // CHECK: fatal error: too many errors emitted, stopping now [-ferror-limit=]
60 // CHECK-NOT: Assertion{{.*}}failed