| 1 |
// PR c++/123814 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
// { dg-additional-options "-Wall --param ggc-min-expand=0 --param ggc-min-heapsize=0" } |
| 4 |
|
| 5 |
namespace std { |
| 6 |
struct source_location { |
| 7 |
struct __impl { |
| 8 |
const char *_M_file_name; |
| 9 |
const char *_M_function_name; |
| 10 |
unsigned _M_line; |
| 11 |
unsigned _M_column; |
| 12 |
}; |
| 13 |
static void current(const __impl* = __builtin_source_location()); |
| 14 |
}; |
| 15 |
} // namespace std |
| 16 |
|
| 17 |
template <typename> concept same_as = true; |
| 18 |
|
| 19 |
template <typename... Us> |
| 20 |
concept one_of = (same_as<Us> || ...); |
| 21 |
|
| 22 |
template <one_of<> T> constexpr int buffer_size_for_int = 0; |
| 23 |
template <> constexpr int buffer_size_for_int<int> = 1; |
| 24 |
|
| 25 |
template <int> using Basic_Characters = int; |
| 26 |
|
| 27 |
template <typename T> |
| 28 |
Basic_Characters<buffer_size_for_int<T>> to_characters() { |
| 29 |
std::source_location::current(); |
| 30 |
} // { dg-warning "return statement" } |
| 31 |
|
| 32 |
void go() { |
| 33 |
to_characters<int>(); |
| 34 |
} |