http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59480

            Bug ID: 59480
           Summary: Missing error diagnostic: friend declaration
                    specifying a default argument must be a definition
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org

The following code compiles with GCC with "g++ -Wall -Werror -std=c++11
-pedantic":

class test {
  friend int bar(int = true);
};

However, with Clang++ it is rejected with:
  error: friend declaration specifying a default argument must be a definition


In N3337, one finds at the end of the paragraph 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."

Reply via email to