1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <queue> 10 // UNSUPPORTED: c++98, c++03, c++11, c++14 11 // UNSUPPORTED: libcpp-no-deduction-guides 12 13 #include <queue> 14 #include <list> 15 #include <iterator> 16 #include <cassert> 17 #include <cstddef> 18 19 20 int main(int, char**) 21 { 22 // Test the explicit deduction guides 23 { 24 // queue(const Container&, const Alloc&); 25 // The '45' is not an allocator 26 std::queue que(std::list<int>{1,2,3}, 45); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'queue'}} 27 } 28 29 { 30 // queue(const queue&, const Alloc&); 31 // The '45' is not an allocator 32 std::queue<int> source; 33 std::queue que(source, 45); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'queue'}} 34 } 35 36 // Test the implicit deduction guides 37 { 38 // queue (allocator &) 39 std::queue que((std::allocator<int>())); // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'queue'}} 40 // Note: The extra parens are necessary, since otherwise clang decides it is a function declaration. 41 // Also, we can't use {} instead of parens, because that constructs a 42 // stack<allocator<int>, allocator<allocator<int>>> 43 } 44 45 46 return 0; 47 } 48