On 21/05/2014 23:19, David Majnemer wrote:
Author: majnemer
Date: Wed May 21 15:19:59 2014
New Revision: 209319
URL: http://llvm.org/viewvc/llvm-project?rev=209319&view=rev
Log:
Sema: Implement DR244
Summary:
Naming the destructor using a typedef-name for the class-name is
well-formed.
This fixes PR19620.
Reviewers: rsmith, doug.gregor
Did Doug participate in review for this patch?
Looking through SVN history, I'm seeing an alarming number of confusing
review trails.
If review happened off-list that's fine, but it needs to be stated
clearly because the system works on trust.
(In fact, I'm seeing relatively inactive developer names showing up
suspiciously in these "Reviewers" lines while some of the most active
reviewers barely appear at all. Could this be a problem with Phabricator
or some internal system you guys are using?)
Alp.
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D3583
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/p6.cpp
cfe/trunk/test/CXX/drs/dr2xx.cpp
cfe/trunk/www/cxx_dr_status.html
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=209319&r1=209318&r2=209319&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Wed May 21 15:19:59 2014
@@ -121,31 +121,26 @@ ParsedType Sema::getDestructorName(Sourc
bool AlreadySearched = false;
bool LookAtPrefix = true;
- // C++ [basic.lookup.qual]p6:
+ // C++11 [basic.lookup.qual]p6:
// If a pseudo-destructor-name (5.2.4) contains a nested-name-specifier,
// the type-names are looked up as types in the scope designated by the
- // nested-name-specifier. In a qualified-id of the form:
+ // nested-name-specifier. Similarly, in a qualified-id of the form:
//
- // ::[opt] nested-name-specifier ~ class-name
+ // nested-name-specifier[opt] class-name :: ~ class-name
//
- // where the nested-name-specifier designates a namespace scope, and in
- // a qualified-id of the form:
+ // the second class-name is looked up in the same scope as the first.
//
- // ::opt nested-name-specifier class-name :: ~ class-name
- //
- // the class-names are looked up as types in the scope designated by
- // the nested-name-specifier.
- //
- // Here, we check the first case (completely) and determine whether the
- // code below is permitted to look at the prefix of the
- // nested-name-specifier.
+ // Here, we determine whether the code below is permitted to look at the
+ // prefix of the nested-name-specifier.
DeclContext *DC = computeDeclContext(SS, EnteringContext);
if (DC && DC->isFileContext()) {
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 +158,6 @@ ParsedType Sema::getDestructorName(Sourc
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
Modified: cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/p6.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/p6.cpp?rev=209319&r1=209318&r2=209319&view=diff
==============================================================================
--- cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/p6.cpp (original)
+++ cfe/trunk/test/CXX/basic/basic.lookup/basic.lookup.qual/p6.cpp Wed May 21
15:19:59 2014
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
struct C {
typedef int I;
@@ -20,5 +21,5 @@ struct A {
typedef A AB;
int main() {
AB *p;
- p->AB::~AB(); // expected-error{{expected the class name after '~' to name a
destructor}}
+ p->AB::~AB();
}
Modified: cfe/trunk/test/CXX/drs/dr2xx.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr2xx.cpp?rev=209319&r1=209318&r2=209319&view=diff
==============================================================================
--- cfe/trunk/test/CXX/drs/dr2xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr2xx.cpp Wed May 21 15:19:59 2014
@@ -466,7 +466,7 @@ namespace dr243 { // dr243: yes
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 @@ namespace dr244 { // dr244: no
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,11 +1013,16 @@ namespace dr298 { // dr298: yes
B::B() {} // expected-error {{requires a type specifier}}
B::A() {} // ok
- C::~C() {} // expected-error {{expected the class name}}
- C::~A() {} // ok
+ C::~C() {} // expected-error {{destructor cannot be declared using a typedef
'C' (aka 'const dr298::A') of the class name}}
typedef struct D E; // expected-note {{here}}
struct E {}; // expected-error {{conflicts with typedef}}
+
+ struct F {
+ ~F();
+ };
+ typedef const F G;
+ G::~F() {} // ok
}
namespace dr299 { // dr299: yes c++11
Modified: cfe/trunk/www/cxx_dr_status.html
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_dr_status.html?rev=209319&r1=209318&r2=209319&view=diff
==============================================================================
--- cfe/trunk/www/cxx_dr_status.html (original)
+++ cfe/trunk/www/cxx_dr_status.html Wed May 21 15:19:59 2014
@@ -1504,7 +1504,7 @@ accessible?</td>
<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>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
--
http://www.nuanti.com
the browser experts
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits