Skip to content

Commit 0c7d6db

Browse files
Collect pending Changes entries for 2026-11-03 []
1 parent 2d71da5 commit 0c7d6db

3 files changed

Lines changed: 49 additions & 45 deletions

File tree

‎src/Changes‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,54 @@
11
Version 7.1
22

3+
11/3/26 [GH #423]
4+
Class-type template parameters of enclosing templates in member templates
5+
6+
When an enclosing template (e.g., a class template) was instantiated, a
7+
reference to one of its nontype template parameters of class type in the
8+
signature of a member template was replaced by the template parameter
9+
object. When the member template's own template arguments were
10+
substituted, that reference was then treated as a prvalue instead of as a
11+
const lvalue. As a result, taking its address caused deduction to fail, and
12+
other uses (e.g., in a decltype operand) caused a spurious "unexpected
13+
function type" error. That is now fixed. For example, with --c++20:
14+
15+
struct A { int i = 0; };
16+
constexpr A a1{1};
17+
template <A V> struct S {
18+
template <typename T> static auto f(T t) -> decltype(t, &V);
19+
template <typename T> static auto g(T t) -> decltype(t, V);
20+
};
21+
using R1 = decltype(S<a1>::f(0)); // Previously, no instance matched.
22+
using R2 = decltype(S<a1>::g(0)); // Previously, "unexpected function
23+
// type" error.
24+
25+
26+
11/3/26 [GH #462]
27+
decltype of template parameters in requires-expression parameter types
28+
29+
When a requires-expression appeared in a template other than a concept
30+
definition (e.g., in a variable template initializer or a function template
31+
body), decltype applied to a template parameter in the type of one of its
32+
parameters was not substituted correctly. The parameter then got an
33+
unusable type, so that any requirement using it in an operation (e.g., a
34+
call) was considered unsatisfied. Similarly, in a member template of a class
35+
template, decltype applied to a class-type template parameter of the class
36+
template produced the const type of the template parameter object (rather
37+
than the declared type of the template parameter) once the class template
38+
was instantiated. That is now fixed. For example, with --c++20:
39+
40+
struct A { int operator()() { return 0; } };
41+
template <auto F>
42+
constexpr bool b = requires(decltype(F) f) { f(); };
43+
static_assert(b<A{}>); // Previously failed.
44+
template <auto F> struct S {
45+
template <int I> static constexpr bool m() {
46+
return requires(decltype(F) f) { f(); };
47+
}
48+
};
49+
static_assert(S<A{}>::m<1>()); // Previously failed.
50+
51+
352
10/31/26 [GH #106]
453
C++26: returning a reference bound to a temporary is not allowed
554

‎src/pending_changes/gh-423-template-param-object-member-template.txt‎

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎src/pending_changes/gh-462-requires-expr-param-decltype.txt‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)