[libcxx-commits] [libcxx] e74bb34 - [libc++] Remove unused std::function test

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 10 16:49:56 PST 2023


Author: Louis Dionne
Date: 2023-02-10T16:49:47-08:00
New Revision: e74bb3471fc45793ecda2eb2862f5880075526ac

URL: https://github.com/llvm/llvm-project/commit/e74bb3471fc45793ecda2eb2862f5880075526ac
DIFF: https://github.com/llvm/llvm-project/commit/e74bb3471fc45793ecda2eb2862f5880075526ac.diff

LOG: [libc++] Remove unused std::function test

We don't support std::function in C++03 anymore, and the test had
started failing due to compilation errors instead of the ABI bug it
was supposed to demonstrate.

Added: 
    

Modified: 
    

Removed: 
    libcxx/test/libcxx/utilities/function.objects/abi_bug_cxx03_cxx11_example.sh.cpp


################################################################################
diff  --git a/libcxx/test/libcxx/utilities/function.objects/abi_bug_cxx03_cxx11_example.sh.cpp b/libcxx/test/libcxx/utilities/function.objects/abi_bug_cxx03_cxx11_example.sh.cpp
deleted file mode 100644
index 11384d83ef02..000000000000
--- a/libcxx/test/libcxx/utilities/function.objects/abi_bug_cxx03_cxx11_example.sh.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// REQUIRES: clang || apple-clang
-// XFAIL: *
-
-// This tests is meant to demonstrate an existing ABI bug between the
-// C++03 and C++11 implementations of std::function. It is not a real test.
-
-// RUN: %{cxx} -c %s -o %t.first.o %{flags} %{compile_flags} -std=c++03 -g
-// RUN: %{cxx} -c %s -o %t.second.o -DWITH_MAIN %{flags} %{compile_flags} -g -std=c++11
-// RUN: %{cxx} -o %t.exe %t.first.o %t.second.o %{flags} %{link_flags} -g
-// RUN: %{run}
-
-#include <functional>
-#include <cassert>
-
-typedef std::function<void(int)> Func;
-
-Func CreateFunc();
-
-#ifndef WITH_MAIN
-// In C++03, the functions call operator, which is a part of the vtable,
-// is defined as 'void operator()(int)', but in C++11 it's
-// void operator()(int&&)'. So when the C++03 version is passed to C++11 code
-// the value of the integer is interpreted as its address.
-void test(int x) {
-  assert(x == 42);
-}
-Func CreateFunc() {
-  Func f(&test);
-  return f;
-}
-#else
-int main(int, char**) {
-  Func f = CreateFunc();
-  f(42);
-  return 0;
-}
-#endif


        


More information about the libcxx-commits mailing list