diff options
author | Yabin Cui <yabinc@google.com> | 2020-02-04 17:18:41 -0800 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2020-02-05 18:17:58 +0000 |
commit | 948f0624554f3811020daadc5413f87dace964c3 (patch) | |
tree | 1ff10d4f5dab6c28f8f4712a3d0ce186ee4abb52 /compiler/optimizing/graph_visualizer.cc | |
parent | 51ad7fe2ecfb731d5d23e08ec3c58909825d0beb (diff) |
jni: Fix templates for clang-r377782 update.
In the next clang update, non-type template parameter of function type T
is adjusted to be type "pointer to T". It follows section 17.1.8 in
c++17 standard. But it reports error when compiling code like below:
template <typename T, T fn>
class helper;
template <typename T, typename... Args, T fn(Args...)>
class helper<T(Args...), fn> {};
error: class template partial specialization is not more specialized than
the primary template [-Winvalid-partial-specialization]
The reason is the non-type template parameter fn of
helper<T(Args...), fn> is decayed to T (*)(Args...), making the partial
specialization not match primary template <typename T, T fn>.
To fix this, use <typename T, T* fn> in the primary template. And use
function pointer type explicitly in the partial template specialization
to make code clear.
Bug: 148287303
Test: run jni_compiler_tests.
Change-Id: I99731b08032574b6fc4c1d45bba19e240e9354b4
Diffstat (limited to 'compiler/optimizing/graph_visualizer.cc')
0 files changed, 0 insertions, 0 deletions