[PATCH] Sema: Implement DR244
David Majnemer
david.majnemer at gmail.com
Thu May 1 00:48:07 PDT 2014
Hi rsmith, doug.gregor,
Naming the destructor using a typedef-name for the class-name is
well-formed.
This fixes PR19620.
http://reviews.llvm.org/D3583
Files:
lib/Sema/SemaExprCXX.cpp
test/CXX/basic/basic.lookup/basic.lookup.qual/p6.cpp
test/CXX/drs/dr2xx.cpp
www/cxx_dr_status.html
Index: lib/Sema/SemaExprCXX.cpp
===================================================================
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -144,8 +144,10 @@
AlreadySearched = true;
LookupCtx = DC;
isDependent = false;
- } else if (DC && isa<CXXRecordDecl>(DC))
+ } else if (DC && isa<CXXRecordDecl>(DC)) {
LookAtPrefix = false;
+ LookInScope = true;
+ }
// The second case from the C++03 rules quoted further above.
NestedNameSpecifier *Prefix = 0;
@@ -163,8 +165,6 @@
LookupCtx = computeDeclContext(SS, EnteringContext);
isDependent = LookupCtx && LookupCtx->isDependentContext();
}
-
- LookInScope = false;
} else if (ObjectTypePtr) {
// C++ [basic.lookup.classref]p3:
// If the unqualified-id is ~type-name, the type-name is looked up
Index: test/CXX/basic/basic.lookup/basic.lookup.qual/p6.cpp
===================================================================
--- test/CXX/basic/basic.lookup/basic.lookup.qual/p6.cpp
+++ test/CXX/basic/basic.lookup/basic.lookup.qual/p6.cpp
@@ -20,5 +20,5 @@
typedef A AB;
int main() {
AB *p;
- p->AB::~AB(); // expected-error{{expected the class name after '~' to name a destructor}}
+ p->AB::~AB();
}
Index: test/CXX/drs/dr2xx.cpp
===================================================================
--- test/CXX/drs/dr2xx.cpp
+++ test/CXX/drs/dr2xx.cpp
@@ -466,7 +466,7 @@
A a2 = b; // expected-error {{ambiguous}}
}
-namespace dr244 { // dr244: no
+namespace dr244 { // dr244: 3.5
struct B {}; struct D : B {}; // expected-note {{here}}
D D_object;
@@ -480,7 +480,7 @@
B_ptr->~B_alias();
B_ptr->B_alias::~B();
// This is valid under DR244.
- B_ptr->B_alias::~B_alias(); // FIXME: expected-error {{expected the class name after '~' to name a destructor}}
+ B_ptr->B_alias::~B_alias();
B_ptr->dr244::~B(); // expected-error {{refers to a member in namespace}}
B_ptr->dr244::~B_alias(); // expected-error {{refers to a member in namespace}}
}
@@ -1013,7 +1013,6 @@
B::B() {} // expected-error {{requires a type specifier}}
B::A() {} // ok
- C::~C() {} // expected-error {{expected the class name}}
C::~A() {} // ok
typedef struct D E; // expected-note {{here}}
Index: www/cxx_dr_status.html
===================================================================
--- www/cxx_dr_status.html
+++ www/cxx_dr_status.html
@@ -1504,7 +1504,7 @@
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#244">244</a></td>
<td>CD1</td>
<td>Destructor lookup</td>
- <td class="none" align="center">No</td>
+ <td class="svn" align="center">SVN</td>
</tr>
<tr id="245">
<td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#245">245</a></td>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3583.9008.patch
Type: text/x-patch
Size: 2822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140501/05973e24/attachment.bin>
More information about the cfe-commits
mailing list