diff options
| author | Kaelyn Takata <rikka@google.com> | 2015-01-27 18:26:18 +0000 |
|---|---|---|
| committer | Kaelyn Takata <rikka@google.com> | 2015-01-27 18:26:18 +0000 |
| commit | 05f40509283f6fd476144d02778623b1cb7d35eb (patch) | |
| tree | 332bfb85e98f8e2d9aeffe30224433d6ec585ecb /clang/test/Sema | |
| parent | b1e6c2dd3d9da079cb7586395bfcf9f68d2e414a (diff) | |
| download | bcm5719-llvm-05f40509283f6fd476144d02778623b1cb7d35eb.tar.gz bcm5719-llvm-05f40509283f6fd476144d02778623b1cb7d35eb.zip | |
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
Diffstat (limited to 'clang/test/Sema')
| -rw-r--r-- | clang/test/Sema/typo-correction.c | 5 |
1 files changed, 5 insertions, 0 deletions
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}} }; |

