Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8074319

barrier_set_cast defined via friend injection

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P1
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      gc
    • Resolved In Build:
      b55
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        The barrier_set_cast function template is presently defined within the BarrierSet class, as a friend. (It needs access to a private helper metafunction defined in that class.)

        For ordinary functions this shouldn't work; the ARM-specified friend injection was removed from the language pre-standardization. However, it seems that many compilers allow such injection when the friend is a template, and as a result the current implementation slipped through testing. This problem was first discovered by attempting to build with Xcode5 (OSX) and failing, while the official JDK9 OSX compiler is presently Xcode4, which accepts the code.

        The fix is to change the in-class definition to merely a friend declaration and move the definition to namespace scope. See C++03 7.3.1.2 [namespace.memdef] clause 3 for details.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  kbarrett Kim Barrett
                  Reporter:
                  kbarrett Kim Barrett
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: