[LLVMbugs] [Bug 16771] New: rejects-valid with trailing return type on function-returning-function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 1 18:06:07 PDT 2013


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

            Bug ID: 16771
           Summary: rejects-valid with trailing return type on
                    function-returning-function
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

<stdin>:1:1: error: 'auto' return without trailing return type
auto (*f())() -> int;
^

This appears to be valid in C++1y, and maybe in C++11 too. (*f()) is a
noptr-declarator, so this conforms to the grammar. In 8.3.5p2, we have

  D1 = (*f())
  T = auto

and the type of the contained declarator-id in the declaration T D1 is
"function of () returning pointer to auto", and T is the single type-specifier
'auto', so this doesn't violate 8.3.5p2's restrictions, and gives f the type
"function of () returning pointer to function of () returning int".

In C++11, the declaration "T D1" is ill-formed by 7.1.6.4p2, because the auto
type-specifier did not appear with a trailing-return-type. It's not obvious
whether that makes the original declaration ill-formed; both EDG and g++ accept
it.

-- 
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/20130802/31503436/attachment.html>


More information about the llvm-bugs mailing list