xref: /llvm-project/clang/test/SemaCXX/pr51171-crash.cpp (revision 8eaa05d06161db69e68ff2a5f4c8e3545a4e8080)
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s
2 
3 // Ensure that we don't crash if errors are suppressed by an error limit.
4 // RUN: not %clang_cc1 -fsyntax-only -std=c++17 -ferror-limit 1 %s
5 
6 template <bool is_const, typename tag_t = void>
7 struct tv_val {
8 };
9 
10 template <bool is_const>
val(const tv_val<is_const> & val)11 auto &val(const tv_val<is_const> &val) { return val.val(); } // expected-note {{possible target for call}}
12 
13 struct Class {
14   template <bool is_const>
15   struct Entry {
16     tv_val<is_const> val;
17   };
18 };
19 
20 enum Types : int {
21   Class = 1, // expected-note 2 {{struct 'Class' is hidden}}
22 };
23 
24 struct Record {
25   Class *val_;            // expected-error {{must use 'struct' tag}}
26   void setClass(Class *); // expected-error {{must use 'struct' tag}}
27 };
28 
setClass(Class * val)29 void Record::setClass(Class *val) { // expected-error {{variable has incomplete type 'void'}} \
30                                    // expected-error {{reference to overloaded function}} \
31                                    // expected-error {{expected ';' after top level declarator}}
32   val_ = val;
33 }
34