File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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}}
You can’t perform that action at this time.
0 commit comments