Created attachment 178748 [details] This testcase should *not* compile Yesterday I update my stable/11 system to r311880. The switch to Clang 3.9.1 (r309124 in head and r310618 in stable/11) caused some C++ regressions for me. Clang from ports and the base system are affected, but only clang > 3.8.x, so this is an upstream issue: https://llvm.org/bugs/show_bug.cgi?id=31606 I'm opening this report to track the upstream progress and notify the relevant parties of the need to patch and MFC, once the issue is resolved upstream.
This problem is caused by commit https://reviews.llvm.org/rL274049, as has been reported in the upstream PR.
There has been an upstream commit: http://llvm.org/viewvc/llvm-project?view=revision&revision=291955
Clang 4.0.0 has been imported in r314564, and this contains upstream commit r291955.
stable/11 is still affected.
A commit references this bug: Author: dim Date: Tue Mar 7 21:44:05 UTC 2017 New revision: 314883 URL: https://svnweb.freebsd.org/changeset/base/314883 Log: Pull in r291403 from upstream clang trunk (by Richard Smith): PR30305: Implement proposed DR resolution to prevent slicing via inherited constructor. The rule we use is that a construction of a class type T from an argument of type U cannot use an inherited constructor if U is the same as T or is derived from T (or if the initialization would first convert it to such a type). This (approximately) matches the rule in use by GCC, and matches the current proposed DR resolution. Pull in r291955 from upstream clang trunk (by Richard Smith): PR31606: Generalize our tentative DR resolution for inheriting copy/move constructors to better match the pre-P0136R1 behavior. Together, these fix an issue with C++ using declarations sometimes enabling illegal implicit casts. Direct commit to stable/11, since head already has clang 4.0.0, which includes this change. Reported by: kami PR: 215969 Changes: stable/11/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td stable/11/contrib/llvm/tools/clang/include/clang/Sema/Overload.h stable/11/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp
Dominic, can you please verify that this fixes your test cases? Probably https://svnweb.freebsd.org/changeset/base/314883 can also be applied to the clang39 port, if Brooks is OK with it.
Both the attached minimal test case as well as my original unit tests succeed now. Nice work. :)
A commit references this bug: Author: brooks Date: Thu Mar 9 03:10:59 UTC 2017 New revision: 435742 URL: https://svnweb.freebsd.org/changeset/ports/435742 Log: Apply the changes from FreeBSD r314883: Pull in r291403 from upstream clang trunk (by Richard Smith): PR30305: Implement proposed DR resolution to prevent slicing via inherited constructor. The rule we use is that a construction of a class type T from an argument of type U cannot use an inherited constructor if U is the same as T or is derived from T (or if the initialization would first convert it to such a type). This (approximately) matches the rule in use by GCC, and matches the current proposed DR resolution. Pull in r291955 from upstream clang trunk (by Richard Smith): PR31606: Generalize our tentative DR resolution for inheriting copy/move constructors to better match the pre-P0136R1 behavior. Together, these fix an issue with C++ using declarations sometimes enabling illegal implicit casts. Direct commit to stable/11, since head already has clang 4.0.0, which includes this change. PR: 215969 Submitted by: dim Changes: head/devel/llvm39/Makefile head/devel/llvm39/files/clang-patch-tools_clang_include_clang_Basic_DiagnosticSemaKinds.td head/devel/llvm39/files/clang-patch-tools_clang_lib_Sema_SemaOverload.cpp head/devel/llvm39/files/config-patch-tools_clang_include_clang_Sema_Overload.h