16e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 26e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 36e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// found in the LICENSE file. 46e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 56e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "scoped_refptr.h" 66e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 76e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)struct Foo { 86e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) int dummy; 96e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}; 106e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 116e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)struct Bar : public Foo { 126e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) int another_dummy; 136e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}; 146e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 156e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Ensure that scoped_refptr<A> -> scoped_refptr<B> conversions are not 166e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// converted. 176e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)void ExpectsScopedPtr(const scoped_refptr<Foo>& foo) { 186e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) scoped_refptr<Foo> temp(foo); 196e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)} 206e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 216e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)void CallExpectsScopedPtrWithBar() { 226e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) scoped_refptr<Bar> temp(new Bar); 236e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) ExpectsScopedPtr(temp); 246e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)} 25