summaryrefslogtreecommitdiff
path: root/test/SemaCXX/constructor-initializer.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-02-20 13:06:31 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-02-20 13:06:31 +0000
commitbca07a4524feb4edec581062d631a13116320a24 (patch)
treea9243275843fbeaa590afc07ee888e006b8d54ea /test/SemaCXX/constructor-initializer.cpp
parent998bc5802ecdd65ce3b270f6c69a8ae8557f0a10 (diff)
Notes
Diffstat (limited to 'test/SemaCXX/constructor-initializer.cpp')
-rw-r--r--test/SemaCXX/constructor-initializer.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/test/SemaCXX/constructor-initializer.cpp b/test/SemaCXX/constructor-initializer.cpp
index 31d53302bf47..e439a76c17cc 100644
--- a/test/SemaCXX/constructor-initializer.cpp
+++ b/test/SemaCXX/constructor-initializer.cpp
@@ -144,9 +144,13 @@ int IntWrapper(int i) { return 0; };
class InitializeUsingSelfExceptions {
int A;
int B;
+ int C;
+ void *P;
InitializeUsingSelfExceptions(int B)
: A(IntWrapper(A)), // Due to a conservative implementation, we do not report warnings inside function/ctor calls even though it is possible to do so.
- B(B) {} // Not a warning; B is a local variable.
+ B(B), // Not a warning; B is a local variable.
+ C(sizeof(C)), // sizeof doesn't reference contents, do not warn
+ P(&P) {} // address-of doesn't reference contents (the pointer may be dereferenced in the same expression but it would be rare; and weird)
};
class CopyConstructorTest {
@@ -235,3 +239,32 @@ namespace test3 {
}
};
}
+
+// PR8075
+namespace PR8075 {
+
+struct S1 {
+ enum { FOO = 42 };
+ static const int bar = 42;
+ static int baz();
+ S1(int);
+};
+
+const int S1::bar;
+
+struct S2 {
+ S1 s1;
+ S2() : s1(s1.FOO) {}
+};
+
+struct S3 {
+ S1 s1;
+ S3() : s1(s1.bar) {}
+};
+
+struct S4 {
+ S1 s1;
+ S4() : s1(s1.baz()) {}
+};
+
+}