aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/default-expr-arguments.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-11 20:24:53 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-11 20:24:53 +0000
commitbe0f7bd61c7b2879d02ae75aad7a91d92f819d94 (patch)
tree0edcd80a2e655a0b30d4ce726ad49c422608cacd /test/SemaTemplate/default-expr-arguments.cpp
parenteb661ed531667bfcb456af4ca9b5f19b29afa0d7 (diff)
When parsing default function arguments, do not mark any declarations
used in the default function argument as "used". Instead, when we actually use the default argument, make another pass over the expression to mark any used declarations as "used" at that point. This addresses two kinds of related problems: 1) We were marking some declarations "used" that shouldn't be, because we were marking them too eagerly. 2) We were failing to mark some declarations as "used" when we should, if the first time it was instantiated happened to be an unevaluated context, we wouldn't mark them again at a later point. I've also added a potentially-handy visitor class template EvaluatedExprVisitor, which only visits the potentially-evaluated subexpressions of an expression. I bet this would have been useful for noexcept... Fixes PR5810 and PR8127. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113700 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate/default-expr-arguments.cpp')
-rw-r--r--test/SemaTemplate/default-expr-arguments.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp
index 7c3525a1fb..c898e102bc 100644
--- a/test/SemaTemplate/default-expr-arguments.cpp
+++ b/test/SemaTemplate/default-expr-arguments.cpp
@@ -206,3 +206,31 @@ namespace InstForInit {
Holder<int> h(i);
}
};
+
+namespace PR5810b {
+ template<typename T>
+ T broken() {
+ T t;
+ double**** not_it = t;
+ }
+
+ void f(int = broken<int>());
+ void g() { f(17); }
+}
+
+namespace PR8127 {
+ template< typename T > class PointerClass {
+ public:
+ PointerClass( T * object_p ) : p_( object_p ) {
+ p_->acquire();
+ }
+ private:
+ T * p_;
+ };
+
+ class ExternallyImplementedClass;
+
+ class MyClass {
+ void foo( PointerClass<ExternallyImplementedClass> = 0 );
+ };
+}