aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/constructor-init.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-26 22:43:07 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-26 22:43:07 +0000
commitd6068482648a366ac9fc297a84780e922ab63a7a (patch)
treeb683b69013ca0faee3d9bad9cd4228dd9deaef27 /test/CodeGenCXX/constructor-init.cpp
parent3bc96eb2246cae9c0a7ece1cb051d28313162936 (diff)
When adding initializers to a constructor, be sure that we are looking
through the bases and fields of the definition of the class in which the constructor is declared, rather than some other declaration of that class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99661 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/constructor-init.cpp')
-rw-r--r--test/CodeGenCXX/constructor-init.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGenCXX/constructor-init.cpp b/test/CodeGenCXX/constructor-init.cpp
index a0a35fa16f..284b8b5938 100644
--- a/test/CodeGenCXX/constructor-init.cpp
+++ b/test/CodeGenCXX/constructor-init.cpp
@@ -80,3 +80,24 @@ void f() {
// CHECK-NOT: call void @_ZN1AIsED1Ev
// CHECK: ret void
}
+
+template<typename T>
+struct X {
+ X(const X &);
+
+ T *start;
+ T *end;
+};
+
+template<typename T> struct X;
+
+// Make sure that the instantiated constructor initializes start and
+// end properly.
+// CHECK: define linkonce_odr void @_ZN1XIiEC2ERKS0_
+// CHECK: {{store.*null}}
+// CHECK: {{store.*null}}
+// CHECK: ret
+template<typename T>
+X<T>::X(const X &other) : start(0), end(0) { }
+
+X<int> get_X(X<int> x) { return x; }