Bug 215969 - c++ compiler regression
Summary: c++ compiler regression
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.0-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-toolchain (Nobody)
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2017-01-11 14:51 UTC by Dominic Fandrey
Modified: 2017-03-09 03:11 UTC (History)
3 users (show)

See Also:


Attachments
This testcase should *not* compile (191 bytes, text/x-c++src)
2017-01-11 14:51 UTC, Dominic Fandrey
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dominic Fandrey freebsd_committer freebsd_triage 2017-01-11 14:51:39 UTC
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.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2017-01-12 18:38:22 UTC
This problem is caused by commit https://reviews.llvm.org/rL274049, as has been reported in the upstream PR.
Comment 2 Dominic Fandrey freebsd_committer freebsd_triage 2017-01-14 14:31:45 UTC
There has been an upstream commit: http://llvm.org/viewvc/llvm-project?view=revision&revision=291955
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2017-03-03 16:11:23 UTC
Clang 4.0.0 has been imported in r314564, and this contains upstream commit r291955.
Comment 4 Dominic Fandrey freebsd_committer freebsd_triage 2017-03-07 10:52:50 UTC
stable/11 is still affected.
Comment 5 commit-hook freebsd_committer freebsd_triage 2017-03-07 21:45:10 UTC
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
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2017-03-07 21:55:06 UTC
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.
Comment 7 Dominic Fandrey freebsd_committer freebsd_triage 2017-03-08 07:54:07 UTC
Both the attached minimal test case as well as my original unit tests succeed now. Nice work. :)
Comment 8 commit-hook freebsd_committer freebsd_triage 2017-03-09 03:11:41 UTC
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