[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)
commita461174cfd36859423fe75f7b4c17b32ce1f41ee
treebae7c8394a3337cd554fd6657ae1c553091d3717
parent88194dfe1a8cef14805bf8696d6391f38f78f2d7
[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

llvm-svn: 344057
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/SemaCUDA/implicit-member-target-inherited.cu [new file with mode: 0644]
clang/test/SemaCUDA/inherited-ctor.cu [new file with mode: 0644]