The dg-error was on the wrong line in this test. It happened to pass by chance because it was on line 31 and the error happened at location 30:31 so the column number matched the dg-error line number!
Running with -fno-show-column caused it to fail. Splitting the expression into three lines allows us to put the dg-error with the right sub-expression, and make sure it matches what's intended. Tested powerpc64le-linux, committed to trunk.
commit 203176bafe5b215f44bd82dd4e5cacd06a1cb6ab Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Wed Jul 27 17:32:45 2016 +0000 * testsuite/20_util/forward/1_neg.cc: Move dg-error to right line. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238793 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/libstdc++-v3/testsuite/20_util/forward/1_neg.cc b/libstdc++-v3/testsuite/20_util/forward/1_neg.cc index d2f3477..97851f2 100644 --- a/libstdc++-v3/testsuite/20_util/forward/1_neg.cc +++ b/libstdc++-v3/testsuite/20_util/forward/1_neg.cc @@ -27,8 +27,9 @@ template<class T, class A1, class A2> std::shared_ptr<T> factory(A1&& a1, A2&& a2) { - return std::shared_ptr<T>(new T(std::forward<A1>(a1), - std::forward<A2>(a2))); // { dg-error "rvalue" } + return std::shared_ptr<T>( + new T(std::forward<A1>(a1), // { dg-error "rvalue" } + std::forward<A2>(a2))); } struct A