]> granicus.if.org Git - clang/commit
[CUDA][HIP] Fix ShouldDeleteSpecialMember for inherited constructors
authorYaxun Liu <Yaxun.Liu@amd.com>
Tue, 9 Oct 2018 15:53:14 +0000 (15:53 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Tue, 9 Oct 2018 15:53:14 +0000 (15:53 +0000)
commit47b01c3d4b1906279589b36af1d38ee3b29fe3ae
tree8387a14ef1b05ad9e68d9da9aee43573ed9d1e11
parent255eaa6faa1dda6783e6f3ec182a5ac776fd41c5
[CUDA][HIP] Fix ShouldDeleteSpecialMember for inherited constructors

ShouldDeleteSpecialMember is called upon inherited constructors.
It calls inferCUDATargetForImplicitSpecialMember.

Normally the special member enum passed to ShouldDeleteSpecialMember
matches the constructor. However this is not true when inherited
constructor is passed, where DefaultConstructor is passed to treat
the inherited constructor as DefaultConstructor. However
inferCUDATargetForImplicitSpecialMember expects the special
member enum argument to match the constructor, which results
in assertion when this expection is not satisfied.

This patch checks whether the constructor is inherited. If true it will
get the real special member enum for the constructor and pass it
to inferCUDATargetForImplicitSpecialMember.

Differential Revision: https://reviews.llvm.org/D51809

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344057 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaDeclCXX.cpp
test/SemaCUDA/implicit-member-target-inherited.cu [new file with mode: 0644]
test/SemaCUDA/inherited-ctor.cu [new file with mode: 0644]