[llvm-bugs] [Bug 37613] New: Block literal example in Block language spec doesn't compile

via llvm-bugs llvm-bugs at lists.llvm.org
Mon May 28 10:18:21 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37613

            Bug ID: 37613
           Summary: Block literal example in Block language spec doesn't
                    compile
           Product: Documentation
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: General docs
          Assignee: unassignedbugs at nondot.org
          Reporter: spoon.reloaded at gmail.com
                CC: llvm-bugs at lists.llvm.org

In the Clang Block language spec, section "Block Literal Expressions"
(https://clang.llvm.org/docs/BlockLanguageSpec.html#block-literal-expressions),
there is an example for block literal syntax that says the following:


Given:

typedef int (*pointerToFunctionThatReturnsIntWithCharArg)(char);
pointerToFunctionThatReturnsIntWithCharArg functionPointer;
^ pointerToFunctionThatReturnsIntWithCharArg (float x) { return
functionPointer; }

and:

^ int ((*)(float x))(char) { return functionPointer; }

are equivalent expressions, [...]


However, the second example, i.e.

^ int ((*)(float x))(char) { return functionPointer; }

does not compile in Clang. It produces the error "function cannot return
function type 'int (char)'".


The following expression does compile:

^ int (*(float x))(char) { return functionPointer; }

I am not sure whether it is the intended one.

-- 
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/20180528/9b502a85/attachment-0001.html>


More information about the llvm-bugs mailing list