/* Change flag_abi_version to be the actual current ABI level, for the
benefit of c_cpp_builtins, and to make comparison simpler. */
- const int latest_abi_version = 14;
+ const int latest_abi_version = 15;
/* Generate compatibility aliases for ABI v11 (7.1) by default. */
const int abi_compat_default = 11;
; 13: Fixes the accidental change in 12 to the calling convention for classes
; with deleted copy constructor and trivial move constructor.
; Default in G++ 8.2.
+;
; 14: Corrects the mangling of nullptr expression.
; Default in G++ 10.
;
+; 15: Changes the mangling of __alignof__ to be distinct from that of alignof.
+; Default in G++ 11.
+;
; Additional positive integers will be assigned as new versions of
; the ABI become the default version of the ABI.
fabi-version=
else
goto normal_expr;
}
- else if (TREE_CODE (expr) == ALIGNOF_EXPR
- && TYPE_P (TREE_OPERAND (expr, 0)))
+ else if (TREE_CODE (expr) == ALIGNOF_EXPR)
{
- write_string ("at");
- write_type (TREE_OPERAND (expr, 0));
+ if (!ALIGNOF_EXPR_STD_P (expr))
+ {
+ if (abi_warn_or_compat_version_crosses (15))
+ G.need_abi_warning = true;
+ if (abi_version_at_least (15))
+ {
+ /* We used to mangle __alignof__ like alignof. */
+ write_string ("v111__alignof__");
+ if (TYPE_P (TREE_OPERAND (expr, 0)))
+ write_type (TREE_OPERAND (expr, 0));
+ else
+ write_expression (TREE_OPERAND (expr, 0));
+ return;
+ }
+ }
+ if (TYPE_P (TREE_OPERAND (expr, 0)))
+ {
+ write_string ("at");
+ write_type (TREE_OPERAND (expr, 0));
+ }
+ else
+ goto normal_expr;
}
else if (code == SCOPE_REF
|| code == BASELINK)
Version 14, which first appeared in G++ 10, corrects the mangling of
the nullptr expression.
+Version 15, which first appeared in G++ 11, changes the mangling of
+@code{__alignof__} to be distinct from that of @code{alignof}.
+
See also @option{-Wabi}.
@item -fabi-compat-version=@var{n}
// This testcase will need to be kept in sync with c_common_post_options.
// { dg-options "-fabi-version=0" }
-#if __GXX_ABI_VERSION != 1014
+#if __GXX_ABI_VERSION != 1015
#error "Incorrect value of __GXX_ABI_VERSION"
#endif
--- /dev/null
+// PR c++/88115
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-pedantic" }
+
+// Verify we mangle __alignof__ differently from alignof.
+
+#include <cstddef>
+
+template <class T> void f1(decltype(alignof(T))) { }
+template <class T> void f2(decltype(alignof(T{}))) { }
+template <class T> void f3(decltype(__alignof__(T))) { }
+template <class T> void f4(decltype(__alignof__(T{}))) { }
+
+template void f1<int>(std::size_t);
+template void f2<int>(std::size_t);
+template void f3<int>(std::size_t);
+template void f4<int>(std::size_t);
+
+// { dg-final { scan-assembler "_Z2f1IiEvDTatT_E" } }
+// { dg-final { scan-assembler "_Z2f2IiEvDTaztlT_EE" } }
+// { dg-final { scan-assembler "_Z2f3IiEvDTv111__alignof__T_E" } }
+// { dg-final { scan-assembler "_Z2f4IiEvDTv111__alignof__tlT_EE" } }
--- /dev/null
+// PR c++/88115
+// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-pedantic -fabi-version=14 -Wabi" }
+
+#include "alignof7.C"
+
+// { dg-warning "changes between" "" { target *-*-* } 11 }
+// { dg-warning "changes between" "" { target *-*-* } 12 }
+
+// { dg-final { scan-assembler "_Z2f1IiEvDTatT_E" } }
+// { dg-final { scan-assembler "_Z2f2IiEvDTaztlT_EE" } }
+// { dg-final { scan-assembler "_Z2f3IiEvDTatT_E" } }
+// { dg-final { scan-assembler "_Z2f4IiEvDTaztlT_EE" } }
}
case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
- d_append_string (dpi, "operator ");
- d_print_comp (dpi, options, dc->u.s_extended_operator.name);
- return;
+ {
+ struct demangle_component *name = dc->u.s_extended_operator.name;
+ if (name->type == DEMANGLE_COMPONENT_NAME
+ && !strncmp (name->u.s_name.s, "__alignof__", name->u.s_name.len))
+ d_print_comp (dpi, options, dc->u.s_extended_operator.name);
+ else
+ {
+ d_append_string (dpi, "operator ");
+ d_print_comp (dpi, options, dc->u.s_extended_operator.name);
+ }
+ return;
+ }
case DEMANGLE_COMPONENT_CONVERSION:
d_append_string (dpi, "operator ");
if (code && !strcmp (code, "gs"))
/* Avoid parens after '::'. */
d_print_comp (dpi, options, operand);
- else if (code && !strcmp (code, "st"))
- /* Always print parens for sizeof (type). */
+ else if ((code && !strcmp (code, "st"))
+ || (op->type == DEMANGLE_COMPONENT_EXTENDED_OPERATOR
+ && (op->u.s_extended_operator.name->type
+ == DEMANGLE_COMPONENT_NAME)
+ && !strncmp (op->u.s_extended_operator.name->u.s_name.s,
+ "__alignof__",
+ op->u.s_extended_operator.name->u.s_name.len)))
+ /* Always print parens for sizeof (type) and __alignof__. */
{
d_append_char (dpi, '(');
d_print_comp (dpi, options, operand);
# PR 96143
_Z2F2IZ1FvEUlvE_EN1AIT_E1XES2_
A<F()::{lambda()#1}>::X F2<F()::{lambda()#1}>(F()::{lambda()#1})
+
+# PR 88115
+_Z1fIiEvDTv111__alignof__T_E
+void f<int>(decltype (__alignof__(int)))
+
+_Z1fIiEvDTv111__alignof__tlT_EE
+void f<int>(decltype (__alignof__(int{})))