mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 04:26:07 +00:00

…to handle template argument values that are pointers one-past-the-end of a non-array symbol. Also improves error messages in other template argument scenarios where clang bails. https://github.com/llvm/llvm-project/issues/97756 I don't think I hooked up the unit test right. I'm not sure one is really needed for what boils down to a tweaked if statement. Please advise.
20 lines
470 B
C++
20 lines
470 B
C++
// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -emit-llvm -std=c++20 -x c++ < %s | FileCheck -check-prefix=WIN64 %s
|
|
|
|
struct A {
|
|
const int* ptr;
|
|
};
|
|
|
|
template<A> void tfn() {};
|
|
|
|
// WIN64: ??$tfn@$2UA@@PEBH5CE?ints@@3QBHB06@@@@@YAXXZ
|
|
constexpr int ints[] = { 1, 2, 7, 8, 9, -17, -10 };
|
|
|
|
// WIN64: ??$tfn@$2UA@@PEBH5E?one_int@@3HB@@@@YAXXZ
|
|
constexpr int one_int = 7;
|
|
|
|
void template_instance() {
|
|
tfn<A{ints + sizeof(ints)/sizeof(int)}>();
|
|
tfn<A{&one_int + 1}>();
|
|
}
|
|
|