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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to