35 changes: 35 additions & 0 deletions clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,3 +468,38 @@ namespace PR46637 {
X<f> y;
int n = y.call(); // expected-error {{cannot initialize a variable of type 'int' with an rvalue of type 'void *'}}
}

namespace PR48517 {
template<const int *P> struct A { static constexpr const int *p = P; };
template<typename T> auto make_nonconst() {
static int n;
return A<&n>();
};
using T = decltype(make_nonconst<int>()); // expected-note {{previous}}
using U = decltype(make_nonconst<float>());
static_assert(T::p != U::p);
using T = U; // expected-error {{different types}}

template<typename T> auto make_const() {
static constexpr int n = 42;
return A<&n>();
};
using V = decltype(make_const<int>()); // expected-note {{previous}}
using W = decltype(make_const<float>());
static_assert(*V::p == *W::p);
static_assert(V::p != W::p);
using V = W; // expected-error {{different types}}

template<auto V> struct Q {
using X = int;
static_assert(V == "primary template should not be instantiated");
};
template<typename T> struct R {
int n;
constexpr int f() {
return Q<&R::n>::X;
}
};
template<> struct Q<&R<int>::n> { static constexpr int X = 1; };
static_assert(R<int>().f() == 1);
}
4 changes: 2 additions & 2 deletions clang/www/cxx_dr_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -8293,7 +8293,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://wg21.link/cwg1413">1413</a></td>
<td>CD3</td>
<td>Missing cases of value-dependency</td>
<td class="none" align="center">Unknown</td>
<td class="unreleased" align="center">Clang 12</td>
</tr>
<tr class="open" id="1414">
<td><a href="https://wg21.link/cwg1414">1414</a></td>
Expand Down Expand Up @@ -12415,7 +12415,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
<td><a href="https://wg21.link/cwg2100">2100</a></td>
<td>C++17</td>
<td>Value-dependent address of static data member of class template</td>
<td class="none" align="center">Unknown</td>
<td class="unreleased" align="center">Clang 12</td>
</tr>
<tr id="2101">
<td><a href="https://wg21.link/cwg2101">2101</a></td>
Expand Down