Files
libcxx/test/std/utilities/utility/forward/forward.fail.cpp
Eric Fiselier dfcb00a2c5 Fix failing -verify tests due to change in Clangs static_assert message.
Clang recently changed the way it outputs static assert diagnostics.
This patch fixes libc++'s -verify tests so they tolerate both the old
and new message format.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@313499 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-17 20:57:05 +00:00

54 lines
1.4 KiB
C++

//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// test forward
#include <utility>
#include "test_macros.h"
struct A
{
};
A source() {return A();}
const A csource() {return A();}
int main()
{
#if TEST_STD_VER >= 11
{
std::forward<A&>(source()); // expected-note {{requested here}}
// expected-error-re@type_traits:* 1 {{static_assert failed {{.*}} "can not forward an rvalue as an lvalue"}}
}
#else
{
std::forward<A&>(source()); // expected-error {{no matching function for call to 'forward'}}
}
#endif
{
const A ca = A();
std::forward<A&>(ca); // expected-error {{no matching function for call to 'forward'}}
}
{
std::forward<A&>(csource()); // expected-error {{no matching function for call to 'forward'}}
}
{
const A ca = A();
std::forward<A>(ca); // expected-error {{no matching function for call to 'forward'}}
}
{
std::forward<A>(csource()); // expected-error {{no matching function for call to 'forward'}}
}
{
A a;
std::forward(a); // expected-error {{no matching function for call to 'forward'}}
}
}