[PATCH] D67509: [CUDA][HIP] Diagnose defaulted constructor only if it is used
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 13 13:16:09 PDT 2019
yaxunl added a comment.
Sorry I found some issue with the fix.
The following code:
struct A { virtual ~A(); };
struct B: public A { B(); };
B::B() = default;
will cause B::B() with external linkage emitted in IR, since `B::B() = default;` is a function definition.
This somehow defeats the intention not to emit B::B() in device code if its base class has virtual member function.
On the other hand, if we remove `B::B() = default;` from the above code, B::B() will become a `__host__` function.
I think host/device property of `B::B()` should be determined at declaration and should not be changed by its definition.
In the above example, it should always be a `__host__` function and should not be emitted in device code.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67509/new/
https://reviews.llvm.org/D67509
More information about the cfe-commits
mailing list