public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/87699] Implement CWG 1512
[not found] <bug-87699-4@http.gcc.gnu.org/bugzilla/>
@ 2020-04-13 0:28 ` mpolacek at gcc dot gnu.org
2020-04-13 0:29 ` mpolacek at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-13 0:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87699
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|beliveau0213 at gmail dot com |mpolacek at gcc dot gnu.org
CC| |mpolacek at gcc dot gnu.org
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Mine, for GCC 11.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/87699] Implement CWG 1512
[not found] <bug-87699-4@http.gcc.gnu.org/bugzilla/>
2020-04-13 0:28 ` [Bug c++/87699] Implement CWG 1512 mpolacek at gcc dot gnu.org
@ 2020-04-13 0:29 ` mpolacek at gcc dot gnu.org
2020-04-13 0:30 ` mpolacek at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-13 0:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87699
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler@googlemail.
| |com
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 94563 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/87699] Implement CWG 1512
[not found] <bug-87699-4@http.gcc.gnu.org/bugzilla/>
2020-04-13 0:28 ` [Bug c++/87699] Implement CWG 1512 mpolacek at gcc dot gnu.org
2020-04-13 0:29 ` mpolacek at gcc dot gnu.org
@ 2020-04-13 0:30 ` mpolacek at gcc dot gnu.org
2020-05-18 20:27 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-13 0:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87699
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
See Daniel's testcase for why this is more important than it might seem:
template<class T, decltype((((T*) 0) < nullptr), true) = false>
bool test(T*)
{
return true;
}
int main()
{
test((int*)(nullptr));
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/87699] Implement CWG 1512
[not found] <bug-87699-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2020-04-13 0:30 ` mpolacek at gcc dot gnu.org
@ 2020-05-18 20:27 ` cvs-commit at gcc dot gnu.org
2020-05-18 20:32 ` mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-18 20:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87699
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:ae8ed736addb2b005d54c0b3191ac599a04ec170
commit r11-467-gae8ed736addb2b005d54c0b3191ac599a04ec170
Author: Marek Polacek <polacek@redhat.com>
Date: Wed May 13 15:52:42 2020 -0400
c++: Implement DR 1512, Pointer comparison vs qual convs [PR87699]
This patch resolves DR 1512 (and, by turn, DR 583). This entails:
1) Relational pointer comparisons against null pointer constants have
been made ill-formed:
void f(char *p) {
if (p > 0)
// ...
}
was always invalid in C but was -- accidentally -- allowed in C++.
2) This was ill-formed:
bool foo(int** x, const int** y) {
return x < y;
}
because 'int**' couldn't be converted to 'const int**'. This was
fixed by re-defining a generic composite pointer type. The composite
type of these two pointers will be 'const int *const *', to which
both pointers can be converted.
3) The overload descriptions for built-in operators were adjusted,
because objects of type std::nullptr_t cannot be used with relational
operators any more.
I fixed 1) by adjusting cp_build_binary_op; we already had a warning
for it so made it a hard error now.
Then 2) required tweaking composite_pointer_type_r. [expr.type] defines
the composite pointer type by using the "cv-combined type." We didn't
implement the [conv.qual]/3.3 part; previously the composite type of
'int**' and 'const int**' was 'const int**', so this didn't compile:
void f(const int **p, int **q) {
true ? p : q;
}
I wrote a more extensive test for this which uses decltype and some
template magic to check the composite type, see composite-ptr-type.C.
We still don't handle everything that [expr.type] requires us to,
but it's pretty close.
And finally 3) was handled in add_builtin_candidate. Turned out we
weren't creating built-in operator candidates when the type was
std::nullptr_t at all. We should, for == and !=. Tested in builtin4.C.
In passing, I'm fixing some of the comments too.
DR 1512
PR c++/87699
* call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
operator functions when type is std::nullptr_t for ==/!=.
* typeck.c (composite_pointer_type_r): Add bool a * parameter. Use
it
to maybe add "const" to the pointer type.
(composite_pointer_type): Update the call to
composite_pointer_type_r.
(cp_build_binary_op): Turn two warning_at into error_at. Print the
types.
* g++.dg/cpp0x/constexpr-array-ptr10.C: Change dg-warning to
dg-error
and adjust the expected messages in dg-error.
* g++.dg/expr/composite-ptr-type.C: New test.
* g++.dg/expr/ptr-comp1.C: New test.
* g++.dg/expr/ptr-comp2.C: New test.
* g++.dg/expr/ptr-comp3.C: New test.
* g++.dg/overload/builtin4.C: New test.
* g++.dg/warn/Wextra-3.C: Change dg-warning to dg-error.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/87699] Implement CWG 1512
[not found] <bug-87699-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2020-05-18 20:27 ` cvs-commit at gcc dot gnu.org
@ 2020-05-18 20:32 ` mpolacek at gcc dot gnu.org
2021-03-21 23:34 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-18 20:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87699
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Implemented in GCC 11.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/87699] Implement CWG 1512
[not found] <bug-87699-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2020-05-18 20:32 ` mpolacek at gcc dot gnu.org
@ 2021-03-21 23:34 ` redi at gcc dot gnu.org
2021-07-22 23:48 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2021-03-21 23:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87699
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=99701
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to CVS Commits from comment #7)
> 3) The overload descriptions for built-in operators were adjusted,
> because objects of type std::nullptr_t cannot be used with relational
> operators any more.
This apparently wasn't completely done, see PR 99701.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/87699] Implement CWG 1512
[not found] <bug-87699-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2021-03-21 23:34 ` redi at gcc dot gnu.org
@ 2021-07-22 23:48 ` pinskia at gcc dot gnu.org
2021-07-27 22:19 ` pinskia at gcc dot gnu.org
2024-01-20 17:13 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-22 23:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87699
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |zhonghao at pku dot org.cn
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 86579 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/87699] Implement CWG 1512
[not found] <bug-87699-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2021-07-22 23:48 ` pinskia at gcc dot gnu.org
@ 2021-07-27 22:19 ` pinskia at gcc dot gnu.org
2024-01-20 17:13 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-27 22:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87699
--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 86228 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/87699] Implement CWG 1512
[not found] <bug-87699-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2021-07-27 22:19 ` pinskia at gcc dot gnu.org
@ 2024-01-20 17:13 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-20 17:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87699
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.0
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-01-20 17:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-87699-4@http.gcc.gnu.org/bugzilla/>
2020-04-13 0:28 ` [Bug c++/87699] Implement CWG 1512 mpolacek at gcc dot gnu.org
2020-04-13 0:29 ` mpolacek at gcc dot gnu.org
2020-04-13 0:30 ` mpolacek at gcc dot gnu.org
2020-05-18 20:27 ` cvs-commit at gcc dot gnu.org
2020-05-18 20:32 ` mpolacek at gcc dot gnu.org
2021-03-21 23:34 ` redi at gcc dot gnu.org
2021-07-22 23:48 ` pinskia at gcc dot gnu.org
2021-07-27 22:19 ` pinskia at gcc dot gnu.org
2024-01-20 17:13 ` pinskia 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).