diff options
| author | John McCall <rjmccall@apple.com> | 2009-12-19 09:28:58 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2009-12-19 09:28:58 +0000 |
| commit | 1f4ee7bd2f4105a04811a06294e4654c6e4058c4 (patch) | |
| tree | 1fef3d651a963463bac8e563ef1dcb8a7e9eeddc /clang/test | |
| parent | 4f469974b27e0da7768b1eb30078658f1f382a72 (diff) | |
| download | bcm5719-llvm-1f4ee7bd2f4105a04811a06294e4654c6e4058c4.tar.gz bcm5719-llvm-1f4ee7bd2f4105a04811a06294e4654c6e4058c4.zip | |
Just push a new scope when parsing an out-of-line variable definition.
Magically fixes all the terrible lookup problems associated with not pushing
a new scope. Resolves an ancient xfail and an LLVM misparse.
llvm-svn: 91769
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp | 7 | ||||
| -rw-r--r-- | clang/test/SemaCXX/nested-name-spec.cpp | 13 | ||||
| -rw-r--r-- | clang/test/SemaCXX/qual-id-test.cpp | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp index d6fc8870050..846d385e1e5 100644 --- a/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp +++ b/clang/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp @@ -1,5 +1,10 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -// XFAIL: * + +// C++0x [basic.lookup.unqual]p14: +// If a variable member of a namespace is defined outside of the +// scope of its namespace then any name used in the definition of +// the variable member (after the declarator-id) is looked up as if +// the definition of the variable member occurred in its namespace. namespace N { struct S {}; diff --git a/clang/test/SemaCXX/nested-name-spec.cpp b/clang/test/SemaCXX/nested-name-spec.cpp index 454af5ef196..4e65b41e666 100644 --- a/clang/test/SemaCXX/nested-name-spec.cpp +++ b/clang/test/SemaCXX/nested-name-spec.cpp @@ -207,3 +207,16 @@ namespace test1 { } }; } + +// We still need to do lookup in the lexical scope, even if we push a +// non-lexical scope. +namespace test2 { + namespace ns { + int *count_ptr; + } + namespace { + int count = 0; + } + + int *ns::count_ptr = &count; +} diff --git a/clang/test/SemaCXX/qual-id-test.cpp b/clang/test/SemaCXX/qual-id-test.cpp index 856e42bd434..00dc662d067 100644 --- a/clang/test/SemaCXX/qual-id-test.cpp +++ b/clang/test/SemaCXX/qual-id-test.cpp @@ -137,4 +137,4 @@ struct a { a a; -int a::sa = a.a; +int a::sa = a.a; // expected-error {{invalid use of nonstatic data member 'a'}} |

