public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-8670] c++: problematic assert in reference_binding [PR113141]
@ 2024-05-01 22:16 Patrick Palka
0 siblings, 0 replies; only message in thread
From: Patrick Palka @ 2024-05-01 22:16 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:c70abea054fe0021b7b2c2e07996afaadc17a07b
commit r13-8670-gc70abea054fe0021b7b2c2e07996afaadc17a07b
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed May 1 18:16:08 2024 -0400
c++: problematic assert in reference_binding [PR113141]
r14-9946 / r14-9947 fixed this PR properly for GCC 14.
For GCC 13, let's just remove the problematic assert.
PR c++/113141
gcc/cp/ChangeLog:
* call.cc (reference_binding): Remove badness criteria sanity
check in the recursive case.
gcc/testsuite/ChangeLog:
* g++.dg/conversion/ref12.C: New test.
* g++.dg/cpp0x/initlist-ref1.C: new test.
Diff:
---
gcc/cp/call.cc | 1 -
gcc/testsuite/g++.dg/conversion/ref12.C | 13 +++++++++++++
gcc/testsuite/g++.dg/cpp0x/initlist-ref1.C | 16 ++++++++++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index b10bdc62d38..70c7f6178b8 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -2017,7 +2017,6 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags,
if (!new_second)
return NULL;
conv = merge_conversion_sequences (t, new_second);
- gcc_assert (maybe_valid_p || conv->bad_p);
return conv;
}
}
diff --git a/gcc/testsuite/g++.dg/conversion/ref12.C b/gcc/testsuite/g++.dg/conversion/ref12.C
new file mode 100644
index 00000000000..633b7e48e47
--- /dev/null
+++ b/gcc/testsuite/g++.dg/conversion/ref12.C
@@ -0,0 +1,13 @@
+// PR c++/113141
+
+struct Matrix { };
+
+struct TPoint3 { operator const Matrix(); };
+
+void f(Matrix&);
+
+int main() {
+ TPoint3 X;
+ Matrix& m = (Matrix &)X;
+ f((Matrix &)X);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist-ref1.C b/gcc/testsuite/g++.dg/cpp0x/initlist-ref1.C
new file mode 100644
index 00000000000..f893f12dafa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist-ref1.C
@@ -0,0 +1,16 @@
+// PR c++/113141
+// { dg-do compile { target c++11 } }
+
+struct ConvToRef {
+ operator int&();
+};
+
+struct A { int& r; };
+
+void f(A);
+
+int main() {
+ ConvToRef c;
+ A a{{c}};
+ f({{c}});
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-01 22:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-01 22:16 [gcc r13-8670] c++: problematic assert in reference_binding [PR113141] Patrick Palka
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).