diff options
| author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-10-15 21:37:55 +0000 |
|---|---|---|
| committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-10-15 21:37:55 +0000 |
| commit | bbdd6c13dea74ce60a162780e20f052f5cab247c (patch) | |
| tree | dd542c13cb0080622fd7a7f62111ffa3fe67bcfe /clang/test/Sema/attributed-auto-deduction.cpp | |
| parent | 4c879bed5b1b79d98cfc3b45c4ee4d4a32ba8a32 (diff) | |
| download | bcm5719-llvm-bbdd6c13dea74ce60a162780e20f052f5cab247c.tar.gz bcm5719-llvm-bbdd6c13dea74ce60a162780e20f052f5cab247c.zip | |
Sema: handle AttributedTypeLocs in C++14 auto deduction
When performing a type deduction from the return type, the FunctionDecl may be
attributed with a calling convention. In such a case, the retrieved type
location may be an AttributedTypeLoc. Performing a castAs<FunctionProtoTypeLoc>
on such a type loc would result in an assertion as they are not derived types.
Ensure that we correctly handle the attributed type location by looking through
it to the modified type loc.
Fixes an assertion triggered in C++14 mode.
llvm-svn: 219851
Diffstat (limited to 'clang/test/Sema/attributed-auto-deduction.cpp')
| -rw-r--r-- | clang/test/Sema/attributed-auto-deduction.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/Sema/attributed-auto-deduction.cpp b/clang/test/Sema/attributed-auto-deduction.cpp new file mode 100644 index 00000000000..d8dc43d6691 --- /dev/null +++ b/clang/test/Sema/attributed-auto-deduction.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple armv7 -std=c++14 -x c++ %s -fsyntax-only +// expected-no-diagnostics + +void deduce() { + auto lambda = [](int i) __attribute__ (( pcs("aapcs") )) { + return i; + }; + lambda(42); +} + |

