summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-02 20:10:50 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-02 20:10:50 +0000
commita71cc1536167f44f542da2857685f01aa29c0e55 (patch)
tree99e50cc74884f45c2c6d7bb040a0a436f3edfd2a /clang/test/Sema/format-strings.c
parent5dc86337fb6f17a73533952964f9d956461a7716 (diff)
downloadbcm5719-llvm-a71cc1536167f44f542da2857685f01aa29c0e55.tar.gz
bcm5719-llvm-a71cc1536167f44f542da2857685f01aa29c0e55.zip
Implement promotion for enumeration types.
WHAT!?! It turns out that Type::isPromotableIntegerType() was not considering enumeration types to be promotable, so we would never do the promotion despite having properly computed the promotion type when the enum was defined. Various operations on values of enum type just "worked" because we could still compute the integer rank of an enum type; the oddity, however, is that operations such as "add an enum and an unsigned" would often have an enum result type (!). The bug actually showed up as a spurious -Wformat diagnostic (<rdar://problem/7595366>), but in theory it could cause miscompiles. In this commit: - Enum types with a promotion type of "int" or "unsigned int" are promotable. - Tweaked the computation of promotable types for enums - For all of the ABIs, treat enum types the same way as their underlying types (*not* their promotion types) for argument passing and return values - Extend the ABI tester with support for enumeration types llvm-svn: 95117
Diffstat (limited to 'clang/test/Sema/format-strings.c')
-rw-r--r--clang/test/Sema/format-strings.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index d8f7e4f6931..5ce3eb036eb 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/test/Sema/format-strings.c
@@ -179,3 +179,7 @@ void test_asl(aslclient asl) {
asl_log(asl, 0, 3, "Error: %m"); // no-warning
asl_log(asl, 0, 3, "Error: %W"); // expected-warning{{invalid conversion specifier 'W'}}
}
+
+// <rdar://problem/7595366>
+typedef enum { A } int_t;
+void f0(int_t x) { printf("%d\n", x); }
OpenPOWER on IntegriCloud