public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94117] New: non-dependent expr treated as-if dependent
@ 2020-03-10 10:37 nathan at gcc dot gnu.org
2020-03-10 10:40 ` [Bug c++/94117] " jakub at gcc dot gnu.org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-03-10 10:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94117
Bug ID: 94117
Summary: non-dependent expr treated as-if dependent
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nathan at gcc dot gnu.org
Target Milestone: ---
Created attachment 48006
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48006&action=edit
distilled from ranges
We accept the attached test case, which should be rejected.
It comes from these two fragments of the ranges header:
lines ~1595
static constexpr decltype(auto)
__iter_move(const _Iterator& __i = {})
noexcept(noexcept(std::__invoke(*__i._M_parent->_M_fun,
*__i._M_current)))
{
if constexpr (is_lvalue_reference_v<decltype(*__i)>)
return std::move(*__i);
else
return *__i;
}
lines ~1752
friend constexpr decltype(auto)
iter_move(const _Iterator& __i) noexcept(noexcept(__iter_move()))
{ return __iter_move(__i); }
If we change __iter_move's argument type to int, we reject complaining that the
call in iter_move's noexcept spec requires the default argument before it's
been parsed. Clang rejects either way.
the '__iter_move ()' call is not dependent because it has no arguments.
Addition of the default argument does not make it dependent.
filing a separate issue to fix libstdc++
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/94117] non-dependent expr treated as-if dependent
2020-03-10 10:37 [Bug c++/94117] New: non-dependent expr treated as-if dependent nathan at gcc dot gnu.org
@ 2020-03-10 10:40 ` jakub at gcc dot gnu.org
2020-03-10 10:44 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-10 10:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94117
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Related or dup of PR93901 ? Guess I'll bisect to see if it is the same commit.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/94117] non-dependent expr treated as-if dependent
2020-03-10 10:37 [Bug c++/94117] New: non-dependent expr treated as-if dependent nathan at gcc dot gnu.org
2020-03-10 10:40 ` [Bug c++/94117] " jakub at gcc dot gnu.org
@ 2020-03-10 10:44 ` jakub at gcc dot gnu.org
2020-03-10 10:47 ` nathan at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-10 10:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94117
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Maybe not, as it doesn't seem to be a regression, it has never been rejected
(at least not in anything since r200000 I've tried).
clang++ rejects with
exception specification is not available until end of class definition
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/94117] non-dependent expr treated as-if dependent
2020-03-10 10:37 [Bug c++/94117] New: non-dependent expr treated as-if dependent nathan at gcc dot gnu.org
2020-03-10 10:40 ` [Bug c++/94117] " jakub at gcc dot gnu.org
2020-03-10 10:44 ` jakub at gcc dot gnu.org
@ 2020-03-10 10:47 ` nathan at gcc dot gnu.org
2020-03-10 11:41 ` redi at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-03-10 10:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94117
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-03-10
--- Comment #3 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
This is the error that should be emitted (modulo the argument type being
_Iterator)
devvm2772:6>./cc1plus -fmodule-header -quiet b_a.H
In file included from b_a.H:1:
b.h:10:69: error: call to 'static void _Iterator<_Const>::mover(const int&)'
uses the default argument for parameter 1, which is not yet defined
10 | friend void move (const _Iterator &arg) noexcept (noexcept (mover
()))
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/94117] non-dependent expr treated as-if dependent
2020-03-10 10:37 [Bug c++/94117] New: non-dependent expr treated as-if dependent nathan at gcc dot gnu.org
` (2 preceding siblings ...)
2020-03-10 10:47 ` nathan at gcc dot gnu.org
@ 2020-03-10 11:41 ` redi at gcc dot gnu.org
2020-03-10 11:54 ` redi at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-10 11:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94117
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Nathan Sidwell from comment #0)
> filing a separate issue to fix libstdc++
Fixed in r10-7103-gc222eabcf8be0e3f644e4bd4c3316b40dba4b514
libstdc++: Fix invalid noexcept-specifier (PR 94117)
G++ fails to diagnose this non-dependent expression, but Clang doesn't
like it.
PR c++/94117
* include/std/ranges
(ranges::transform_view::_Iterator::iter_move):
Change expression in noexcept-specifier to match function body.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/94117] non-dependent expr treated as-if dependent
2020-03-10 10:37 [Bug c++/94117] New: non-dependent expr treated as-if dependent nathan at gcc dot gnu.org
` (3 preceding siblings ...)
2020-03-10 11:41 ` redi at gcc dot gnu.org
@ 2020-03-10 11:54 ` redi at gcc dot gnu.org
2020-03-10 14:28 ` nathan at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-10 11:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94117
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oh we have more occurrences of it in libstdc++, e.g. in split_view
friend constexpr decltype(auto)
iter_move(const _InnerIter& __i) noexcept(noexcept(__iter_move()))
{ return __iter_move(__i); }
friend constexpr void
iter_swap(const _InnerIter& __x, const _InnerIter& __y)
noexcept(noexcept(__iter_swap()))
requires indirectly_swappable<iterator_t<_Base>>
{ __iter_swap(__x, __y); }
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/94117] non-dependent expr treated as-if dependent
2020-03-10 10:37 [Bug c++/94117] New: non-dependent expr treated as-if dependent nathan at gcc dot gnu.org
` (4 preceding siblings ...)
2020-03-10 11:54 ` redi at gcc dot gnu.org
@ 2020-03-10 14:28 ` nathan at gcc dot gnu.org
2020-03-10 14:52 ` [Bug c++/94117] deferred noexcept specifications and friend fns mpolacek at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-03-10 14:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94117
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |nathan at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #6 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Ah, I understand what is happening.
We don't defer parsing of the noexcept specified of friend functions. That
leads us to construct a base-link expr whose type contains the deferred parse
exception specification of the *static* member function -- there being only
one, it doesn't get unknown type.
In processing the deferred exception specification of that fn, we don't fixup
all the type variants that might have been created.
There's a restriction on friend declarations that contain default args. This
is the same problem that is trying to avoid.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/94117] deferred noexcept specifications and friend fns
2020-03-10 10:37 [Bug c++/94117] New: non-dependent expr treated as-if dependent nathan at gcc dot gnu.org
` (5 preceding siblings ...)
2020-03-10 14:28 ` nathan at gcc dot gnu.org
@ 2020-03-10 14:52 ` mpolacek at gcc dot gnu.org
2020-03-11 9:20 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-03-10 14:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94117
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Yes, it was a conscious decision not to defer parsing of noexcept-spec of
friend functions. The standard currently doesn't say we shouldn't defer, but
no compiler implements it. The problem was that friend declarations can be
redeclared and it would be tricky to see if their noexcept-specs match.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/94117] deferred noexcept specifications and friend fns
2020-03-10 10:37 [Bug c++/94117] New: non-dependent expr treated as-if dependent nathan at gcc dot gnu.org
` (6 preceding siblings ...)
2020-03-10 14:52 ` [Bug c++/94117] deferred noexcept specifications and friend fns mpolacek at gcc dot gnu.org
@ 2020-03-11 9:20 ` redi at gcc dot gnu.org
2020-03-11 9:59 ` nathan at gcc dot gnu.org
2020-03-11 12:05 ` marxin at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-11 9:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94117
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #5)
> Oh we have more occurrences of it in libstdc++, e.g. in split_view
Fixed in r10-7108-gcf0c3a457319df1e8dc9321227162a7c57169a39
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/94117] deferred noexcept specifications and friend fns
2020-03-10 10:37 [Bug c++/94117] New: non-dependent expr treated as-if dependent nathan at gcc dot gnu.org
` (7 preceding siblings ...)
2020-03-11 9:20 ` redi at gcc dot gnu.org
@ 2020-03-11 9:59 ` nathan at gcc dot gnu.org
2020-03-11 12:05 ` marxin at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-03-11 9:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94117
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |SUSPENDED
--- Comment #9 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Discussing on the core list https://lists.isocpp.org/core/2020/03/8632.php
(password required)
I have a fix the the problem I encountered on the modules branch. Not suitable
at this stage for trunk, and there's probably a better solution out there.
As Marek says 'nobody implements this'
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/94117] deferred noexcept specifications and friend fns
2020-03-10 10:37 [Bug c++/94117] New: non-dependent expr treated as-if dependent nathan at gcc dot gnu.org
` (8 preceding siblings ...)
2020-03-11 9:59 ` nathan at gcc dot gnu.org
@ 2020-03-11 12:05 ` marxin at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-11 12:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94117
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org
--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> ---
commit r10-7103-gc222eabcf8be0e3f644e4bd4c3316b40dba4b514
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Mar 10 10:50:40 2020 +0000
libstdc++: Fix invalid noexcept-specifier (PR 94117)
G++ fails to diagnose this non-dependent expression, but Clang doesn't
like it.
PR c++/94117
* include/std/ranges
(ranges::transform_view::_Iterator::iter_move):
Change expression in noexcept-specifier to match function body.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2020-03-11 12:05 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-10 10:37 [Bug c++/94117] New: non-dependent expr treated as-if dependent nathan at gcc dot gnu.org
2020-03-10 10:40 ` [Bug c++/94117] " jakub at gcc dot gnu.org
2020-03-10 10:44 ` jakub at gcc dot gnu.org
2020-03-10 10:47 ` nathan at gcc dot gnu.org
2020-03-10 11:41 ` redi at gcc dot gnu.org
2020-03-10 11:54 ` redi at gcc dot gnu.org
2020-03-10 14:28 ` nathan at gcc dot gnu.org
2020-03-10 14:52 ` [Bug c++/94117] deferred noexcept specifications and friend fns mpolacek at gcc dot gnu.org
2020-03-11 9:20 ` redi at gcc dot gnu.org
2020-03-11 9:59 ` nathan at gcc dot gnu.org
2020-03-11 12:05 ` marxin at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).