r181846 - Don't mark a type specifier as "owned" if there is no declaration to own.
Douglas Gregor
dgregor at apple.com
Tue May 14 16:22:32 PDT 2013
Author: dgregor
Date: Tue May 14 18:22:32 2013
New Revision: 181846
URL: http://llvm.org/viewvc/llvm-project?rev=181846&view=rev
Log:
Don't mark a type specifier as "owned" if there is no declaration to own.
This simplifies error recovery elsewhere, eliminating the crash in
<rdar://problem/13853540>.
Modified:
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/test/SemaCXX/nested-name-spec.cpp
Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=181846&r1=181845&r2=181846&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Tue May 14 18:22:32 2013
@@ -651,7 +651,7 @@ bool DeclSpec::SetTypeSpecType(TST T, So
DeclRep = Rep;
TSTLoc = TagKwLoc;
TSTNameLoc = TagNameLoc;
- TypeSpecOwned = Owned;
+ TypeSpecOwned = Owned && Rep != 0;
return false;
}
Modified: cfe/trunk/test/SemaCXX/nested-name-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/nested-name-spec.cpp?rev=181846&r1=181845&r2=181846&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/nested-name-spec.cpp (original)
+++ cfe/trunk/test/SemaCXX/nested-name-spec.cpp Tue May 14 18:22:32 2013
@@ -297,3 +297,13 @@ namespace NS {
int foobar = a + longer_b; // expected-error {{use of undeclared identifier 'a'; did you mean 'NS::a'?}} \
// expected-error {{use of undeclared identifier 'longer_b'; did you mean 'NS::longer_b'?}}
}
+
+// <rdar://problem/13853540>
+namespace N {
+ struct X { };
+ namespace N {
+ struct Foo {
+ struct N::X *foo(); // expected-error{{no struct named 'X' in namespace 'N::N'}}
+ };
+ }
+}
More information about the cfe-commits
mailing list