]> granicus.if.org Git - clang/commitdiff
PR10864: make sure we correctly delay type-checking for inline asm tied operands...
authorEli Friedman <eli.friedman@gmail.com>
Wed, 14 Sep 2011 19:20:00 +0000 (19:20 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 14 Sep 2011 19:20:00 +0000 (19:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139716 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaStmt.cpp
test/SemaTemplate/instantiate-expr-1.cpp

index 7f175b3e1ed4736baf57d9ef3ab21b2d5108ca99..274c74c7b6c474e215d2f8f01802de046f1b8bc1 100644 (file)
@@ -2121,6 +2121,10 @@ StmtResult Sema::ActOnAsmStmt(SourceLocation AsmLoc, bool IsSimple,
     unsigned InputOpNo = i+NumOutputs;
     Expr *OutputExpr = Exprs[TiedTo];
     Expr *InputExpr = Exprs[InputOpNo];
+
+    if (OutputExpr->isTypeDependent() || InputExpr->isTypeDependent())
+      continue;
+
     QualType InTy = InputExpr->getType();
     QualType OutTy = OutputExpr->getType();
     if (Context.hasSameType(InTy, OutTy))
index 7af59fd2d11b68768c5ec492807a8b91cc2a2770..896437488d68a884aeb32960c2cd1215243f7716 100644 (file)
@@ -170,3 +170,16 @@ namespace PR6424 {
 
   template void Y2<3>::f();
 }
+
+namespace PR10864 {
+  template<typename T> class Vals {};
+  template<> class Vals<int> { public: static const int i = 1; };
+  template<> class Vals<float> { public: static const double i; };
+  template<typename T> void test_asm_tied(T o) {
+    __asm("addl $1, %0" : "=r" (o) : "0"(Vals<T>::i)); // expected-error {{input with type 'double' matching output with type 'float'}}
+  }
+  void test_asm_tied() {
+    test_asm_tied(1);
+    test_asm_tied(1.f); // expected-note {{instantiation of}}
+  }
+}