================
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.
///
----------------
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.)
================
Comment at: lib/Sema/SemaDecl.cpp:361
@@ +360,3 @@
+ RD->getTypeForDecl());
+ return SubNNS;
+}
----------------
Reid Kleckner wrote:
> Richard Smith wrote:
> > Once we hit this, we should bail out entirely. (This can currently include
> > local classes in the name specifier, which doesn't seem right.)
> Bail out entirely, as in, return nullptr, or as in, fail the lookup?
I think this has been made irrelevant by other changes.
================
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());
+ }
----------------
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.)
================
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<>;
+}
----------------
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).
http://reviews.llvm.org/D3995
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits