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

clang: friend declaration specifying a default argument must be a definition

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • Arch Linux
      clang version 3.4 (tags/RELEASE_34/final)

      When build hotspot with clang on Linux, following error is reported. The code in question violate C++ 11 spec, and clang is enforcing that rule.

      C++11: §8.3.6.4 [dcl.fct.default]
      "If a friend declaration specifies a default argument expression,
      that declaration shall be a definition and shall be the only declaration
      of the function or function template in the translation unit."

      --- Error messages ---
      /home/hjen/ws/9dev/hotspot/src/share/vm/code/relocInfo.hpp:367:27: error: friend declaration specifying a default argument must be a definition
        inline friend relocInfo prefix_relocInfo(int datalen = 0);
                                ^
      /home/hjen/ws/9dev/hotspot/src/share/vm/code/relocInfo.hpp:462:18: error: friend declaration specifying a default argument must be the only declaration
      inline relocInfo prefix_relocInfo(int datalen) {
                       ^
      /home/hjen/ws/9dev/hotspot/src/share/vm/code/relocInfo.hpp:367:27: note: previous declaration is here
        inline friend relocInfo prefix_relocInfo(int datalen = 0);

            Unassigned Unassigned
            henryjen Henry Jen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: