diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-12-13 00:53:10 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-12-13 00:53:10 +0000 |
commit | fb1f68b69544b4d7895251fc4dbb9dafbc1a8e67 (patch) | |
tree | 07624383d9fc48466776f3293e63ddeea4782515 /test/SemaCXX/typo-correction-delayed.cpp | |
parent | b58ba0b375643a8bd9208c5d82606102db8db9e0 (diff) |
Typo correction: Ignore temporary binding exprs after overload resolution
Transformation of a CallExpr doesn't always result in a new CallExpr.
Fixes PR21899.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224172 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/typo-correction-delayed.cpp')
-rw-r--r-- | test/SemaCXX/typo-correction-delayed.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correction-delayed.cpp index d303b58554..d42888f1e6 100644 --- a/test/SemaCXX/typo-correction-delayed.cpp +++ b/test/SemaCXX/typo-correction-delayed.cpp @@ -119,3 +119,23 @@ class SomeClass { public: explicit SomeClass() : Kind(kSum) {} // expected-error {{use of undeclared identifier 'kSum'; did you mean 'kNum'?}} }; + +extern "C" int printf(const char *, ...); + +// There used to be an issue with typo resolution inside overloads. +struct AssertionResult { + ~AssertionResult(); + operator bool(); + int val; +}; +AssertionResult Compare(const char *a, const char *b); +AssertionResult Compare(int a, int b); +int main() { + // expected-note@+1 {{'result' declared here}} + const char *result; + // expected-error@+1 {{use of undeclared identifier 'resulta'; did you mean 'result'?}} + if (AssertionResult ar = (Compare("value1", resulta))) + ; + else + printf("ar: %d\n", ar.val); +} |