[LLVMbugs] [Bug 15390] New: default arguments should be allowed only in function declaration

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 28 04:57:02 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15390

            Bug ID: 15390
           Summary: default arguments should be allowed only in function
                    declaration
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vanyacpp at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang accepts this code without a error.

void (*k(int a))(int b = 5);

According to standard:

[dcl.fct.default]p3 A default argument shall be specified only in the
parameter-declaration-clause of a function declaration or in a
template-parameter.
[dcl.dcl]p7 If the decl-specifier-seq contains no typedef specifier, the
declaration is called a function declaration if the type associated with the
name is a function type.

I'm not sure if this wording prohibits the code above. But I believe this
default argument is incorrect.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130228/7942d390/attachment.html>


More information about the llvm-bugs mailing list