PR16273: Weaken a bogus assertion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183550 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 8621a2d..9531b2e 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -256,7 +256,8 @@
     assert(!SS.isSet() && "ObjectType and scope specifier cannot coexist");
     LookupCtx = computeDeclContext(ObjectType);
     isDependent = ObjectType->isDependentType();
-    assert((isDependent || !ObjectType->isIncompleteType()) &&
+    assert((isDependent || !ObjectType->isIncompleteType() ||
+            ObjectType->castAs<TagType>()->isBeingDefined()) &&
            "Caller should have completed object type");
     
     // Template names cannot appear inside an Objective-C class or object type.
diff --git a/test/SemaCXX/trailing-return-0x.cpp b/test/SemaCXX/trailing-return-0x.cpp
index bd601db..f7e3433 100644
--- a/test/SemaCXX/trailing-return-0x.cpp
+++ b/test/SemaCXX/trailing-return-0x.cpp
@@ -94,3 +94,11 @@
     auto f() -> decltype((*this)[0]); // expected-error {{cannot be overloaded}}
   };
 }
+
+namespace PR16273 {
+  struct A {
+    template <int N> void f();
+    auto g()->decltype(this->f<0>());
+  };
+}
+