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

This reverts commit a24523ac8dc07f3478311a5969184b922b520395. This is causing significant compile-time regressions for C++ code, see: https://github.com/llvm/llvm-project/pull/126088#issuecomment-2704874202
20 lines
791 B
C++
20 lines
791 B
C++
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -std=c++17 -verify=expected,both %s
|
|
// RUN: %clang_cc1 -std=c++17 -verify=ref,both %s
|
|
|
|
template<typename T, T val> struct A {};
|
|
namespace Temp {
|
|
struct S { int n; };
|
|
constexpr S &addr(S &&s) { return s; }
|
|
A<S &, addr({})> a; // both-error {{reference to temporary object}}
|
|
A<S *, &addr({})> b; // both-error {{pointer to temporary object}}
|
|
A<int &, addr({}).n> c; // both-error {{reference to subobject of temporary object}}
|
|
A<int *, &addr({}).n> d; // both-error {{pointer to subobject of temporary object}}
|
|
}
|
|
|
|
char arr[3];
|
|
A<const char*, &arr[1]> d; // both-error {{refers to subobject '&arr[1]'}}
|
|
|
|
void Func() {
|
|
A<const char*, __func__> a; // both-error {{pointer to subobject of predefined '__func__' variable}}
|
|
}
|