aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2023-06-03 09:03:27 -0400
committerPatrick Palka <ppalka@redhat.com>2023-06-03 09:03:27 -0400
commit999e617d3121b82921c8031ee695fd036f553f04 (patch)
tree1f8957c6a5818113623ea80228eeb55cb1480b82 /gcc
parent38e88d41f50d844f1404172657ef7e8372014ef6 (diff)
downloadgcc-999e617d3121b82921c8031ee695fd036f553f04.zip
gcc-999e617d3121b82921c8031ee695fd036f553f04.tar.gz
gcc-999e617d3121b82921c8031ee695fd036f553f04.tar.bz2
c++: mangle noexcept-expr [PR70790]
This implements noexcept(expr) mangling and demangling as per the Itanium ABI. PR c++/70790 gcc/cp/ChangeLog: * mangle.cc (write_expression): Handle NOEXCEPT_EXPR. libiberty/ChangeLog: * cp-demangle.c (cplus_demangle_operators): Add the noexcept operator. (d_print_comp_inner) <case DEMANGLE_COMPONENT_UNARY>: Always print parens around the operand of noexcept too. * testsuite/demangle-expected: Test noexcept operator demangling. gcc/testsuite/ChangeLog: * g++.dg/abi/mangle78.C: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/mangle.cc5
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle78.C14
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc
index 826c5e7..7dab4e6 100644
--- a/gcc/cp/mangle.cc
+++ b/gcc/cp/mangle.cc
@@ -3402,6 +3402,11 @@ write_expression (tree expr)
else
write_string ("tr");
}
+ else if (code == NOEXCEPT_EXPR)
+ {
+ write_string ("nx");
+ write_expression (TREE_OPERAND (expr, 0));
+ }
else if (code == CONSTRUCTOR)
{
bool braced_init = BRACE_ENCLOSED_INITIALIZER_P (expr);
diff --git a/gcc/testsuite/g++.dg/abi/mangle78.C b/gcc/testsuite/g++.dg/abi/mangle78.C
new file mode 100644
index 0000000..63c4d77
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle78.C
@@ -0,0 +1,14 @@
+// PR c++/70790
+// { dg-do compile { target c++11 } }
+
+template<bool B>
+struct A { };
+
+template<class T>
+void f(A<noexcept(T{})>);
+
+int main() {
+ f<int>({});
+}
+
+// { dg-final { scan-assembler "_Z1fIiEv1AIXnxtlT_EEE" } }