gcc/testsuite/g++.dg/contracts/contracts-comdat1.C
raw| 1 | // Contract condition functions should be local symbols in a comdat group with |
| 2 | // the guarded function. |
| 3 | |
| 4 | // { dg-do compile { target { c++20 && comdat_group } } } |
| 5 | // { dg-additional-options -fcontracts } |
| 6 | // { dg-final { scan-assembler-not "_Z1fi.pre,comdat" } } |
| 7 | // { dg-final { scan-assembler-not {(weak|globl)[^\n]*_Z1fi.pre} } } |
| 8 | |
| 9 | inline int f(int i) |
| 10 | [[ pre: i > 0 ]] |
| 11 | { |
| 12 | return i; |
| 13 | } |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | if (f(42) != 42) |
| 18 | __builtin_abort (); |
| 19 | } |