[PATCH] Sema: Implement DR244
Richard Smith
richard at metafoo.co.uk
Tue May 20 18:43:57 PDT 2014
================
Comment at: lib/Sema/SemaExprCXX.cpp:136-137
@@ -135,4 +135,4 @@
//
// the class-names are looked up as types in the scope designated by
// the nested-name-specifier.
//
----------------
Please update this to match the standard (in particular, "the second class-name is looked up in the same scope as the first").
================
Comment at: lib/Sema/SemaExprCXX.cpp:161-167
@@ -158,11 +160,9 @@
isDependent = isDependentScopeSpecifier(PrefixSS);
} else if (ObjectTypePtr) {
LookupCtx = computeDeclContext(SearchType);
isDependent = SearchType->isDependentType();
} else {
LookupCtx = computeDeclContext(SS, EnteringContext);
isDependent = LookupCtx && LookupCtx->isDependentContext();
}
} else if (ObjectTypePtr) {
----------------
By a strict reading of the standard, I think:
namespace N {
struct A {
struct B {};
};
A *a;
A::B *b;
}
void f() {
a->N::~A(); // ok
b->N::A::~B(); // ill-formed, B is *only* looked up in N
}
... but see also core issue 399. I think our behavior here (with your patch) is appropriate for now.
================
Comment at: test/CXX/drs/dr2xx.cpp:1016
@@ -1015,3 +1015,2 @@
B::A() {} // ok
- C::~C() {} // expected-error {{expected the class name}}
C::~A() {} // ok
----------------
Why was this deleted? If we no longer reject this, that's a regression, and we can no longer claim to implement DR298...
http://reviews.llvm.org/D3583
More information about the cfe-commits
mailing list