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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to