Skip to content

Commit ffdbc5e

Browse files
committed
more tests
1 parent 401f939 commit ffdbc5e

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ Bug Fixes to C++ Support
433433
object type. (#GH151531)
434434
- Suppress ``-Wdouble-promotion`` when explicitly asked for with C++ list initialization (#GH33409).
435435
- Fix the result of `__builtin_is_implicit_lifetime` for types with a user-provided constructor. (#GH160610)
436-
- Correctly deduced return types in ``decltype`` expressions. (#GH160497) (#GH56652) (#GH116319)
436+
- Correctly deduce return types in ``decltype`` expressions. (#GH160497) (#GH56652) (#GH116319) (#GH161196)
437437

438438
Bug Fixes to AST Handling
439439
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/test/SemaCXX/decltype.cpp

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,20 @@ template <class> struct S2 {
192192
}();
193193
};
194194

195-
196195
using T2 = decltype(S2<void>::mem<void>);
197196
//expected-note@-1 {{in instantiation of static data member 'GH160497::S2<void>::mem<void>' requested here}}
198197

198+
template <class> struct S3 {
199+
template <class>
200+
inline static int mem = // Check we don't instantiate when the type is not deduced.
201+
[] { static_assert(false);
202+
return 42;
203+
}();
204+
};
205+
206+
using T = decltype(S3<void>::mem<void>);
207+
}
208+
199209
namespace N1 {
200210

201211
template<class>
@@ -210,6 +220,23 @@ T y = 42;
210220

211221
}
212222
}
223+
namespace GH161196 {
224+
225+
template <typename> struct A {
226+
static constexpr int digits = 0;
227+
};
228+
229+
template <typename> struct B {
230+
template <int, typename MaskInt = int, int = A<MaskInt>::digits>
231+
static constexpr auto XBitMask = 0;
232+
};
233+
234+
struct C {
235+
using ReferenceHost = B<int>;
236+
template <int> static decltype(ReferenceHost::XBitMask<0>) XBitMask;
237+
};
238+
239+
void test() { (void)C::XBitMask<0>; }
213240
#endif
214241

215242
template<typename>

0 commit comments

Comments
 (0)