]> granicus.if.org Git - clang/commit
Sema: handle AttributedTypeLocs in C++14 auto deduction
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 15 Oct 2014 21:37:55 +0000 (21:37 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 15 Oct 2014 21:37:55 +0000 (21:37 +0000)
commit715b1b7df87d4da02c120bbd360910b9da0e609b
tree3f27b3f49ce5aad2749432c8f708d8d276db083d
parent98cb8afec771a7af23722011d075c8d8ecd58e84
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219851 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaStmt.cpp
test/Sema/attributed-auto-deduction.cpp [new file with mode: 0644]