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

barrier_set_cast defined via friend injection

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1 P1
    • 9
    • 9
    • hotspot
    • None
    • gc
    • b55
    • generic
    • generic

        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.

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

                Created:
                Updated:
                Resolved: