1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "weak_ptr_factory.h"
7 namespace should_succeed
{
10 base::WeakPtrFactory
<OnlyMember
> factory_
;
16 base::WeakPtrFactory
<FactoryLast
> factory_
;
19 class FactoryRefersToOtherType
{
21 base::WeakPtrFactory
<bool> bool_ptr_factory_
;
24 class FirstFactoryRefersToOtherType
{
26 base::WeakPtrFactory
<bool> bool_ptr_factory_
;
28 base::WeakPtrFactory
<FirstFactoryRefersToOtherType
> factory_
;
34 base::WeakPtrFactory
<TwoFactories
> factory1_
;
35 base::WeakPtrFactory
<TwoFactories
> factory2_
;
41 ClassTemplate() : factory_(this) {}
44 base::WeakPtrFactory
<ClassTemplate
> factory_
;
46 // Make sure the template gets instantiated:
47 ClassTemplate
<int> g_instance
;
49 } // namespace should_succeed
51 namespace should_fail
{
54 base::WeakPtrFactory
<FactoryFirst
> factory_
;
60 base::WeakPtrFactory
<FactoryMiddle
> factory_
;
64 class TwoFactoriesOneBad
{
66 base::WeakPtrFactory
<TwoFactoriesOneBad
> factory1_
;
68 base::WeakPtrFactory
<TwoFactoriesOneBad
> factory2_
;
74 ClassTemplate() : factory_(this) {}
76 base::WeakPtrFactory
<ClassTemplate
> factory_
;
79 // Make sure the template gets instantiated:
80 ClassTemplate
<int> g_instance
;
82 } // namespace should_fail