c++: Further tweak for P1937R2 - const{expr,eval} inconsistencies
authorJakub Jelinek <jakub@redhat.com>
Fri, 28 Feb 2020 16:35:32 +0000 (17:35 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 28 Feb 2020 16:35:32 +0000 (17:35 +0100)
commit18396541e4793382a989a23f41f5deb347610234
tree70142f3f7cdb056c4037fd52065fa4e1a99f6033
parentf3ce088645e5305d932380c7520809181b2d2eb9
c++: Further tweak for P1937R2 - const{expr,eval} inconsistencies

Seems I've missed one thing, as the first hunk in
https://github.com/cplusplus/draft/commit/c8e68ed202b4a9260616bcee8a9768b5dca4bbca
changes the wording so that only potentially-evaluated id-expressions that
denote immediate functions must appear only in the specified contexts.
That IMO means that in unevaluated contexts there aren't such restrictions
anymore, so I think in unevaluated contexts one should be able to take the
address of an immediate function.

2020-02-28  Jakub Jelinek  <jakub@redhat.com>

P1937R2 - Fixing inconsistencies between const{expr,eval} functions
* typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
functions in unevaluated contexts.

* g++.dg/cpp2a/consteval3.C: Change dg-error about taking address of
immediate function in unevaluated contexts into dg-bogus.
* g++.dg/cpp2a/consteval16.C: New test.
gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/consteval16.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/consteval3.C