diff options
Diffstat (limited to 'test/Analysis/copypaste/generic.c')
| -rw-r--r-- | test/Analysis/copypaste/generic.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/Analysis/copypaste/generic.c b/test/Analysis/copypaste/generic.c new file mode 100644 index 000000000000..9d8392139b39 --- /dev/null +++ b/test/Analysis/copypaste/generic.c @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 -analyze -std=c11 -analyzer-checker=alpha.clone.CloneChecker -verify %s + +// expected-no-diagnostics + +int global; + +int foo1() { + if (global > 0) + return 0; + else if (global < 0) + return _Generic(global, double: 1, float: 2, default: 3); + return 1; +} + +// Different associated type (int instead of float) +int foo2() { + if (global > 0) + return 0; + else if (global < 0) + return _Generic(global, double: 1, int: 2, default: 4); + return 1; +} + +// Different number of associated types. +int foo3() { + if (global > 0) + return 0; + else if (global < 0) + return _Generic(global, double: 1, default: 4); + return 1; +} |
