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

Support separate function declaration and definition with ENABLE_IF-based SFINAE

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 17
    • 17
    • hotspot
    • b07

    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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: