diff options
| author | David L. Jones <dlj@google.com> | 2019-12-04 22:08:38 -0800 |
|---|---|---|
| committer | David L. Jones <dlj@google.com> | 2019-12-04 22:12:15 -0800 |
| commit | 93cc9dddd82f9e971f382ade6acf6634c5914966 (patch) | |
| tree | 90d0ea59b9f2c275cdbcdfe6480e64fa97b95442 /clang/test | |
| parent | 3882edbe191f78547445424cb20983a20b71f4cf (diff) | |
| download | bcm5719-llvm-93cc9dddd82f9e971f382ade6acf6634c5914966.tar.gz bcm5719-llvm-93cc9dddd82f9e971f382ade6acf6634c5914966.zip | |
Revert "Properly convert all declaration non-type template arguments when"
This reverts commit 11d10527852b4d3ed738aa90d8bec0f398160593.
This change is problematic with function pointer template parameters. For
example, building libcxxabi with futexes (-D_LIBCXXABI_USE_FUTEX) produces this
diagnostic:
In file included from .../llvm-project/libcxxabi/src/cxa_guard.cpp:15:
.../llvm-project/libcxxabi/src/cxa_guard_impl.h:416:54: error: address of function 'PlatformThreadID' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
has_thread_id_support(this->thread_id_address && GetThreadIDArg),
~~ ^~~~~~~~~~~~~~
.../llvm-project/libcxxabi/src/cxa_guard.cpp:38:26: note: in instantiation of member function '__cxxabiv1::(anonymous namespace)::InitByteFutex<&__cxxabiv1::(anonymous namespace)::PlatformFutexWait, &__cxxabiv1::(anonymous namespace)::PlatformFutexWake, &__cxxabiv1::(anonymous namespace)::PlatformThreadID>::InitByteFutex' requested here
SelectedImplementation imp(raw_guard_object);
^
.../llvm-project/libcxxabi/src/cxa_guard_impl.h:416:54: note: prefix with the address-of operator to silence this warning
has_thread_id_support(this->thread_id_address && GetThreadIDArg),
^
&
1 error generated.
The diagnostic is incorrect: adding the address-of operator also fails ("cannot
take the address of an rvalue of type 'uint32_t (*)()' (aka 'unsigned int
(*)()')").
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaCXX/exceptions-seh.cpp | 7 | ||||
| -rw-r--r-- | clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp | 32 |
2 files changed, 4 insertions, 35 deletions
diff --git a/clang/test/SemaCXX/exceptions-seh.cpp b/clang/test/SemaCXX/exceptions-seh.cpp index 02bb786160d..1d8cc4917e9 100644 --- a/clang/test/SemaCXX/exceptions-seh.cpp +++ b/clang/test/SemaCXX/exceptions-seh.cpp @@ -39,13 +39,14 @@ void instantiate_bad_scope_tmpl() { } #if __cplusplus < 201103L +// FIXME: Diagnose this case. For now we produce undef in codegen. template <typename T, T FN()> T func_template() { - return FN(); // expected-error 2{{builtin functions must be directly called}} + return FN(); } void inject_builtins() { - func_template<void *, __exception_info>(); // expected-note {{instantiation of}} - func_template<unsigned long, __exception_code>(); // expected-note {{instantiation of}} + func_template<void *, __exception_info>(); + func_template<unsigned long, __exception_code>(); } #endif diff --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp index 7232598215a..7a58dd5dcae 100644 --- a/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp +++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp @@ -394,21 +394,6 @@ namespace PR42362 { Z<f, f, f>::Q q; } -namespace QualConv { - int *X; - template<const int *const *P> void f() { - using T = decltype(P); - using T = const int* const*; - } - template void f<&X>(); - - template<const int *const &R> void g() { - using T = decltype(R); - using T = const int *const &; - } - template void g<(const int *const&)X>(); -} - namespace FunctionConversion { struct a { void c(char *) noexcept; }; template<void (a::*f)(char*)> void g() { @@ -416,21 +401,4 @@ namespace FunctionConversion { using T = void (a::*)(char*); // (not 'noexcept') } template void g<&a::c>(); - - void c() noexcept; - template<void (*p)()> void h() { - using T = decltype(p); - using T = void (*)(); // (not 'noexcept') - } - template void h<&c>(); -} - -namespace VoidPtr { - // Note, this is an extension in C++17 but valid in C++20. - template<void *P> void f() { - using T = decltype(P); - using T = void*; - } - int n; - template void f<(void*)&n>(); } |

