From 05f40509283f6fd476144d02778623b1cb7d35eb Mon Sep 17 00:00:00 2001 From: Kaelyn Takata Date: Tue, 27 Jan 2015 18:26:18 +0000 Subject: Properly handle typos in the conditional of ?: expressions in C. In particular, remove the OpaqueExpr transformation from r225389 and move the correction of the conditional from CheckConditionalOperands to ActOnConditionalOp before the OpaqueExpr is created. This fixes the typo correction behavior in C code that uses the GNU extension for a binary ?: (without an expression between the "?" and the ":"). llvm-svn: 227220 --- clang/test/Sema/typo-correction.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/test/Sema') diff --git a/clang/test/Sema/typo-correction.c b/clang/test/Sema/typo-correction.c index df7da797f05..8276737e4fe 100644 --- a/clang/test/Sema/typo-correction.c +++ b/clang/test/Sema/typo-correction.c @@ -13,6 +13,11 @@ void PR21656() { a = b ? : 0; // expected-warning {{type specifier missing, defaults to 'int'}} \ // expected-error {{use of undeclared identifier 'b'}} +int foobar; // expected-note {{'foobar' declared here}} +a = goobar ?: 4; // expected-warning {{type specifier missing, defaults to 'int'}} \ + // expected-error {{use of undeclared identifier 'goobar'; did you mean 'foobar'?}} \ + // expected-error {{initializer element is not a compile-time constant}} + struct ContainerStuct { enum { SOME_ENUM }; // expected-note {{'SOME_ENUM' declared here}} }; -- cgit v1.2.3