JDK-8258853 : Support separate function declaration and definition with ENABLE_IF-based SFINAE
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-12-23
  • Updated: 2021-01-28
  • Resolved: 2021-01-22
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 17
17 b07Fixed
Related Reports
Relates :  
Description
The ENABLE_IF macro provides convenient syntax for function template SFINAE using the new default template parameter feature of C++11.  However, this macro can only be used in the function declaration (which may also be a definition).

The syntax needed in a definition that is separate from the declaration is different, but the type forms for the non-type template parameters in the two places must be "equivalent" (C++14 14.5.6).  The precise form for ENABLE_IF is "hidden" behind the macro.  It is not desirable to have template definitions making assumptions about that form.

This suggests there should be a second macro for use in the separate definition case, with the two macros maintained together to ensure the necessary consistency.

Comments
Changeset: a97f3c18 Author: Kim Barrett <kbarrett@openjdk.org> Date: 2021-01-22 14:44:35 +0000 URL: https://git.openjdk.java.net/jdk/commit/a97f3c18
22-01-2021