summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/cond4.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/template/cond4.C')
-rw-r--r--gcc/testsuite/g++.dg/template/cond4.C20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/cond4.C b/gcc/testsuite/g++.dg/template/cond4.C
new file mode 100644
index 000000000..35416ba79
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/cond4.C
@@ -0,0 +1,20 @@
+// PR c++/14369
+
+struct A { };
+
+template<class T>
+struct X : A {
+ const A* bar() const
+ { return this; }
+
+ const A& foo() const;
+};
+
+template<class T>
+const A& X<T>::foo() const
+{
+ const A* t = bar();
+ return *(t ? t : throw 0);
+}
+
+