majnemer added a comment.

Running your patch against the following:

  struct __declspec(dllimport) S {
    virtual void f() {}
  };
  S x;
  constexpr S y;

results in:

> Global is marked as dllimport, but not external

>  [2 x i8*]* @"\01??_7S@@6B@"

>  fatal error: error in backend: Broken module found, compilation aborted!

>  clang-3.9: error: clang frontend command failed with exit code 70 (use -v to 
> see invocation)


I don't think your approach will correctly handle instances where we need to 
emit a local vftable and reference an imported vftable simultaneously.

A flag on CXXRecordDecl which is sensitive to the most recent expression 
evaluation might not be the best way to go.
Perhaps we should be able to use the VFTableBuilder to build imported and local 
vftables for the same vftable? Not entirely sure though...


================
Comment at: lib/AST/ExprConstant.cpp:5765
@@ +5764,3 @@
+  if (Info.EvalMode == EvalInfo::EM_ConstantExpression) {
+    if (CXXRecordDecl *CD = dyn_cast<CXXRecordDecl>(
+            E->getType()->castAs<RecordType>()->getDecl()))
----------------
I'd use `auto *` here.


http://reviews.llvm.org/D22034



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

Reply via email to