diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-10-30 01:02:04 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-10-30 01:02:04 +0000 |
| commit | 190d1af17608f05bc9792af21fd0b4e20e438588 (patch) | |
| tree | fcd1bed7c28dd392721d6fdeb5c85e1a41e02a71 /test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp | |
| parent | 58656de61dd044410ad2e9f36b20dfd988400120 (diff) | |
| download | clang-190d1af17608f05bc9792af21fd0b4e20e438588.tar.gz clang-190d1af17608f05bc9792af21fd0b4e20e438588.tar.bz2 clang-190d1af17608f05bc9792af21fd0b4e20e438588.tar.xz | |
PR17731: When determining whether a tag and a non-tag were declared in the same
scope, be careful about function-scope declarations (which are not declared in
their semantic context).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193671 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp')
| -rw-r--r-- | test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp b/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp index 911df98953..1d2b525da4 100644 --- a/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp +++ b/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp @@ -22,3 +22,48 @@ void f() { Y(1); // okay } +namespace PR17731 { + void f() { + struct S { S() {} }; + int S(void); + int a = S(); + struct S b; + { + int S(void); + int a = S(); + struct S c = b; + } + { + struct S { S() {} }; // expected-note {{candidate}} + int a = S(); // expected-error {{no viable conversion from 'S'}} + struct S c = b; // expected-error {{no viable conversion from 'struct S'}} + } + } + void g() { + int S(void); + struct S { S() {} }; + int a = S(); + struct S b; + { + int S(void); + int a = S(); + struct S c = b; + } + { + struct S { S() {} }; // expected-note {{candidate}} + int a = S(); // expected-error {{no viable conversion from 'S'}} + struct S c = b; // expected-error {{no viable conversion from 'struct S'}} + } + } + + struct A { + struct B; + void f(); + int B; + }; + struct A::B {}; + void A::f() { + B = 123; + struct B b; + } +} |
