write_string ("_Z");
write_encoding (decl);
}
+
+ /* If this is the pre/post function for a guarded function, append
+ .pre/post, like something from create_virtual_clone. */
+ if (DECL_IS_PRE_FN_P (decl))
+ write_string (".pre");
+ else if (DECL_IS_POST_FN_P (decl))
+ write_string (".post");
}
/* Returns true if the return type of DECL is part of its signature, and
mangle_return_type_p (decl),
d);
- /* If this is the pre/post function for a guarded function, append
- .pre/post, like something from create_virtual_clone. */
- if (DECL_IS_PRE_FN_P (decl))
- write_string (".pre");
- else if (DECL_IS_POST_FN_P (decl))
- write_string (".post");
-
/* If this is a coroutine helper, then append an appropriate string to
identify which. */
if (tree ramp = DECL_RAMP_FN (decl))
--- /dev/null
+// simple check to ensure we don't emit a function with the same name twice,
+// when wrapping functions in pre- and postconditions.
+// { dg-do link }
+// { dg-options "-std=c++2a -fcontracts -fcontract-continuation-mode=on" }
+
+volatile int x = 10;
+
+extern "C" void
+f ()
+ [[ pre: x < 10 ]]
+{
+}
+
+int
+main ()
+ [[ post: x > 10 ]]
+{
+ f();
+}