================
Comment at: include/clang/AST/Type.h:4056-4057
@@ -4055,4 +4055,4 @@
 
 /// \brief Represents a qualified type name for which the type name is
 /// dependent.
 ///
----------------
Richard Smith wrote:
> You seem to be using this to represent an unqualified type in some cases? 
> (You've made `NNS` optional.) A quick look indicates that downstream code 
> will not do the right thing in this case. (`TreeTransform` will treat it as 
> if an error has occurred, and bail out with no diagnostic, for instance.)
This should be fixed now by using GlobalSpecifier.  I guess I have tests 
covering this case, but we would silently have an invalid AST, so they didn't 
fail.

================
Comment at: lib/Sema/SemaDecl.cpp:353-357
@@ +352,7 @@
+    auto *ND = dyn_cast<NamespaceDecl>(DC);
+    if (ND && !ND->isInline() && !ND->isAnonymousNamespace())
+      return NestedNameSpecifier::Create(Context, nullptr, ND);
+    else if (auto *RD = dyn_cast<CXXRecordDecl>(DC))
+      return NestedNameSpecifier::Create(Context, nullptr, 
RD->isTemplateDecl(),
+                                         RD->getTypeForDecl());
+  }
----------------
Richard Smith wrote:
> What about the translation unit? Should you create a `::` 
> `NestedNameSpecifier` for it? (Once you do that, the `'return nullptr;'` 
> below and the null `NNS` case in `DependentNameType` are unreachable.)
OK, that works.  :)

================
Comment at: test/SemaTemplate/ms-delayed-default-template-args.cpp:6-9
@@ +5,6 @@
+namespace test_basic {
+template <typename T = Baz> // expected-warning {{using the undeclared type 
'Baz' as a default template argument is a Microsoft extension}}
+struct Foo { T x; };
+typedef int Baz;
+template struct Foo<>;
+}
----------------
Richard Smith wrote:
> Reid Kleckner wrote:
> > Richard Smith wrote:
> > > Maybe also add a test for
> > > 
> > >   template<typename T> struct Something {};
> > >   template<typename T = Something<Bar>> struct SomethingElse;
> > > 
> > > ... and
> > > 
> > >   template<Something<Bar> *p> struct AnotherThing;
> > I assume Bar is always undeclared in these tests.
> > 
> > MSVC accepts your first test case, but Clang doesn't with my patch.  I'd 
> > need to find a way to delay instantiating Something<Bar> until later, which 
> > feels beyond the scope of this patch.
> > 
> > The second test is a negative test, right?  Both we and MSVC need to know 
> > the type of the non-type template parameter.
> I had meant for these to both be negative tests (maybe with a FIXME for the 
> first case).
OK, good.  :)

http://reviews.llvm.org/D3995



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to