Skip to content

Commit d1cb9c8

Browse files
committed
clang: tests: added regression test
1 parent 58fe61e commit d1cb9c8

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Copyright 2024 Bloomberg Finance L.P.
4+
//
5+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6+
// See https://llvm.org/LICENSE.txt for license information.
7+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8+
//
9+
//===----------------------------------------------------------------------===//
10+
//
11+
// RUN: %clang_cc1 -std=c++2c -freflection-latest -fexpansion-statements -fsyntax-only -verify %s
12+
13+
void f(); // expected-note {{possible target for call}}
14+
void f(int) { // expected-note {{possible target for call}}
15+
template for (auto x : f); // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}}
16+
}
17+
18+
int g();
19+
void h() {
20+
template for (auto x : g); // expected-error {{cannot expand over a function 'int ()'; did you mean to call it with no arguments?}}
21+
}
22+
23+
// With pointer
24+
void h2() {
25+
int (*fp)() = g;
26+
template for (auto x : fp); // expected-error {{cannot expand over a function 'int (*)()'}}
27+
}
28+
29+
template <typename T> int dep();
30+
template <typename T>
31+
void inst() {
32+
template for (auto x : dep<T>); // expected-error {{cannot expand over a function 'int ()'; did you mean to call it with no arguments?}}
33+
}
34+
template void inst<int>(); // expected-note {{in instantiation of function template specialization 'inst<int>' requested here}}

0 commit comments

Comments
 (0)