summaryrefslogtreecommitdiff
path: root/test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-10-30 01:02:04 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-10-30 01:02:04 +0000
commit190d1af17608f05bc9792af21fd0b4e20e438588 (patch)
treefcd1bed7c28dd392721d6fdeb5c85e1a41e02a71 /test/CXX/basic/basic.scope/basic.scope.hiding/p2.cpp
parent58656de61dd044410ad2e9f36b20dfd988400120 (diff)
downloadclang-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.cpp45
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;
+ }
+}