47 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <queue>10// UNSUPPORTED: c++03, c++11, c++1411 12#include <queue>13#include <list>14#include <iterator>15#include <cassert>16#include <cstddef>17 18int main(int, char**) {19 // Test the explicit deduction guides20 {21 // queue(const Container&, const Alloc&);22 // The '45' is not an allocator23 std::queue que(std::list<int>{1, 2, 3}, 45);24 // expected-error-re@-1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}queue'}}25 }26 27 {28 // queue(const queue&, const Alloc&);29 // The '45' is not an allocator30 std::queue<int> source;31 std::queue que(source, 45);32 // expected-error-re@-1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}queue'}}33 }34 35 // Test the implicit deduction guides36 {37 // queue (allocator &)38 std::queue que((std::allocator< int>()));39 // expected-error-re@-1 {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}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 a42 // stack<allocator<int>, allocator<allocator<int>>>43 }44 45 return 0;46}47