// Copyright (C) 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // . // { dg-options "-std=gnu++0x" } #include #include #include int count = 0; template struct allocator98 : std::allocator { template struct rebind { typedef allocator98 other; }; allocator98() { } template allocator98(const allocator98&) { }; void construct(T* p, const T& val) { ++count; std::allocator::construct(p, val); } }; template struct allocator11 : std::allocator { template struct rebind { typedef allocator11 other; }; allocator11() { } template allocator11(const allocator11&) { }; template void construct(T* p, Args&&... args) { ++count; std::allocator::construct(p, std::forward(args)...); } }; int main() { std::vector< int, allocator98 > v98(1); VERIFY( count == 0 ); std::vector< int, allocator11 > v11(1); VERIFY( count == 1 ); }