[LLVMbugs] [Bug 15119] New: return type of lambda expression with and without const does not work

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 30 02:42:40 PST 2013


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

             Bug #: 15119
           Summary: return type of lambda expression with and without
                    const does not work
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: joerg.richter at pdv-fs.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


cat > t.cc <<EOF
struct Foo {};
void func()
{
  auto a = [](bool arg){
    if( arg )
      return Foo();
    return (const Foo)Foo();
  };
}
EOF
clang -std=c++11 -c t.cc


Gives:
t.cc:7:5: error: return type 'const Foo' must match previous return type 'Foo'
when lambda expression has
      unspecified explicit return type
    return (const Foo)Foo();
    ^
1 error generated.


Don't know if it is really a bug.  But at least GCC accepts it.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list