Skip to content

Commit 48f52aa

Browse files
committed
add test for #427, now solved
1 parent f8624cc commit 48f52aa

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

clang/test/3C/overconstrained_merge.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: rm -rf %t*
2+
// RUN: 3c -base-dir=%S -alltypes -addcr %s -- | FileCheck -match-full-lines %s
3+
// RUN: 3c -base-dir=%S -alltypes -addcr %s -- | %clang -c -fcheckedc-extension -x c -o /dev/null -
4+
// RUN: 3c -base-dir=%S -output-dir=%t.checked -alltypes %s --
5+
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/overconstrained_merge.c -- | diff %t.checked/overconstrained_merge.c -
6+
7+
// Test checks for merging a function after the generics code adds a constraint
8+
// The merge succeeds because it happens earlier in the codebase than the addition
9+
10+
// This test only uses -alltypes because of the use of _Array_ptr in the example
11+
// (to distinguish from the _Ptr that will be added).
12+
_Itype_for_any(T) void free(void * : itype(_Array_ptr<T>));
13+
void b(void) {
14+
char **c;
15+
free(c);
16+
// CHECK: _Array_ptr<_Ptr<char>> c = ((void *)0);
17+
// CHECK: free<_Ptr<char>>(c);
18+
}
19+
void free(void *);

0 commit comments

Comments
 (0)