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 | 3876cc88ac22b74ff0ae0a1f17eb08ba655eb93f (patch) | |
tree | 96489696d91b60c4a4f659c5101939af3559624a /clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp | |
parent | 60db142d8630dec57c32ffd11e0bdf4ccc6ff336 (diff) | |
download | bcm5719-llvm-3876cc88ac22b74ff0ae0a1f17eb08ba655eb93f.tar.gz bcm5719-llvm-3876cc88ac22b74ff0ae0a1f17eb08ba655eb93f.zip |
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).
llvm-svn: 193671
Diffstat (limited to 'clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp')
-rw-r--r-- | clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp b/clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp index 911df989530..1d2b525da4c 100644 --- a/clang/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp +++ b/clang/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; + } +} |