JDK-8033057 : clang: friend declaration specifying a default argument must be a definition
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • CPU: generic
  • Submitted: 2014-01-29
  • Updated: 2014-09-29
  • Resolved: 2014-09-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Description
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);

Comments
Adding the dup link.
29-09-2014

JDK-8023033 include this fix.
31-01-2014

Fix is simpe and straightfoward, diff -r 38affe04ca2d -r b000a01ee9a0 src/share/vm/code/relocInfo.hpp --- a/src/share/vm/code/relocInfo.hpp Thu Jan 23 15:44:56 2014 -0800 +++ b/src/share/vm/code/relocInfo.hpp Mon Jan 27 23:35:09 2014 -0800 @@ -364,7 +364,7 @@ // "immediate" in the prefix header word itself. This optimization // is invisible outside this module.) - inline friend relocInfo prefix_relocInfo(int datalen = 0); + inline friend relocInfo prefix_relocInfo(int datalen); protected: // an immediate relocInfo optimizes a prefix with one 10-bit unsigned value @@ -459,7 +459,7 @@ return relocInfo(relocInfo::none, relocInfo::offset_limit() - relocInfo::offset_unit); } -inline relocInfo prefix_relocInfo(int datalen) { +inline relocInfo prefix_relocInfo(int datalen = 0) { assert(relocInfo::fits_into_immediate(datalen), "datalen in limits"); return relocInfo(relocInfo::data_prefix_tag, relocInfo::RAW_BITS, relocInfo::datalen_tag | datalen); }
29-01-2014