diff options
| author | Volodymyr Sapsai <vsapsai@apple.com> | 2019-03-29 18:47:07 +0000 |
|---|---|---|
| committer | Volodymyr Sapsai <vsapsai@apple.com> | 2019-03-29 18:47:07 +0000 |
| commit | 9e911f3a6476e92f633436045528b1ac2e7d4161 (patch) | |
| tree | 72ed466c4ea9d6148c737f6ca3d0467e2fceb02f /clang/test/SemaCXX/auto-cxx0x.cpp | |
| parent | 4ccb3b96b630b74ac016070b3d0da4b987ad9dc6 (diff) | |
| download | bcm5719-llvm-9e911f3a6476e92f633436045528b1ac2e7d4161.tar.gz bcm5719-llvm-9e911f3a6476e92f633436045528b1ac2e7d4161.zip | |
[Sema] Fix assertion when `auto` parameter in lambda has an attribute.
Fixes the assertion
> no Attr* for AttributedType*
> UNREACHABLE executed at llvm-project/clang/lib/Sema/SemaType.cpp:298!
In `TypeProcessingState::getAttributedType` we put into `AttrsForTypes`
types with `auto` but later in
`TypeProcessingState::takeAttrForAttributedType` we use transformed
types and that's why cannot find `Attr` corresponding to
`AttributedType`.
Fix by keeping `AttrsForTypes` up to date after replacing `AutoType`.
rdar://problem/47689465
Reviewers: rsmith, arphaman, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: jkorous, dexonsmith, jdoerfert, cfe-commits
Differential Revision: https://reviews.llvm.org/D58659
llvm-svn: 357298
Diffstat (limited to 'clang/test/SemaCXX/auto-cxx0x.cpp')
| -rw-r--r-- | clang/test/SemaCXX/auto-cxx0x.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/auto-cxx0x.cpp b/clang/test/SemaCXX/auto-cxx0x.cpp index 074a01bb839..b4da3f9330c 100644 --- a/clang/test/SemaCXX/auto-cxx0x.cpp +++ b/clang/test/SemaCXX/auto-cxx0x.cpp @@ -15,3 +15,11 @@ void g() { // expected-error@-2 {{'auto' not allowed in lambda parameter}} #endif } + +void rdar47689465() { + int x = 0; + [](auto __attribute__((noderef)) *){}(&x); +#if __cplusplus == 201103L + // expected-error@-2 {{'auto' not allowed in lambda parameter}} +#endif +} |

