xref: /aosp_15_r20/external/clang/test/SemaCXX/function-overload-typo-crash.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify %s
2*67e74705SXin Li 
3*67e74705SXin Li // PR10283
4*67e74705SXin Li void min(); //expected-note {{'min' declared here}}
5*67e74705SXin Li void min(int);
6*67e74705SXin Li 
7*67e74705SXin Li template <typename T> void max(T); //expected-note {{'max' declared here}}
8*67e74705SXin Li 
f()9*67e74705SXin Li void f() {
10*67e74705SXin Li   fin(); //expected-error {{use of undeclared identifier 'fin'; did you mean 'min'}}
11*67e74705SXin Li   fax(0); //expected-error {{use of undeclared identifier 'fax'; did you mean 'max'}}
12*67e74705SXin Li }
13*67e74705SXin Li 
14*67e74705SXin Li template <typename T> void somefunc(T*, T*); //expected-note {{'somefunc' declared here}}
15*67e74705SXin Li template <typename T> void somefunc(const T[]); //expected-note {{'somefunc' declared here}}
16*67e74705SXin Li template <typename T1, typename T2> void somefunc(T1*, T2*); //expected-note {{'somefunc' declared here}}
17*67e74705SXin Li template <typename T1, typename T2> void somefunc(T1*, const T2[]); //expected-note 2 {{'somefunc' declared here}}
18*67e74705SXin Li 
c()19*67e74705SXin Li void c() {
20*67e74705SXin Li   int *i = 0, *j = 0;
21*67e74705SXin Li   const int x[] = {1, 2, 3};
22*67e74705SXin Li   long *l = 0;
23*67e74705SXin Li   somefun(i, j); //expected-error {{use of undeclared identifier 'somefun'; did you mean 'somefunc'?}}
24*67e74705SXin Li   somefun(x); //expected-error {{use of undeclared identifier 'somefun'; did you mean 'somefunc'?}}
25*67e74705SXin Li   somefun(i, l); //expected-error {{use of undeclared identifier 'somefun'; did you mean 'somefunc'?}}
26*67e74705SXin Li   somefun(l, x); //expected-error {{use of undeclared identifier 'somefun'; did you mean 'somefunc'?}}
27*67e74705SXin Li   somefun(i, x); //expected-error {{use of undeclared identifier 'somefun'; did you mean 'somefunc'?}}
28*67e74705SXin Li }
29