3.5, C++14, and -g

Hi!

I'm on OS X, and have been eager to try C++14 for months. However I am
stuck with the following for which I have found no relevant
information. Is this being worked on?

Thanks in advance!

$ cat >foo2.cc <<EOF
template <typename T>
struct binary_expr {
    auto operator()(unsigned i){
        return 1;
    }
};

int main(){
    binary_expr<double> b;
    return 0;
}
EOF
$ clang++-mp-3.5 -std=c++14 foo2.cc -g
error: debug information for auto is not yet supported
1 error generated.
$ clang++-mp-3.5 -std=c++14 foo2.cc
$ clang++-mp-3.5 --version
clang version 3.5.0 (branches/release_35 216817)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

It's the same with the Apple's version of clang.

$ clang++ --version
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

See also c++ - Workaround for debug symbol error with auto member function? - Stack Overflow

I’ll cop to this, totally my mistake ( http://llvm.org/bugs/show_bug.cgi?id=16091 ) - this should never have been a fatal, unavoidable error. I’ll look into fixing it, but I don’t think there’s anything we can do for you in the existing, shipped, compilers unfortunately (other than to not use the feature if you want to be able to create debug builds).

You can still use the C++11 “auto f() → int” style return type specifications, though.

Hi David,

Thanks for the answer.

I'll cop to this, totally my mistake ( http://llvm.org/bugs/show_bug.cgi?id=16091 ) - this should never have been a fatal, unavoidable error. I'll look into fixing it,

So do I read that even the current svn version does not behave
as expected?

but I don't think there's anything we can do for you in the existing, shipped, compilers unfortunately (other than to not use the feature if you want to be able to create debug builds).

Is there some work around, such as asking for less accurate
debugging symbols with some magic compiler flags?

Fixed in r221704 - again, apologies for the breakage… :confused:

Fixed in r221704 - again, apologies for the breakage... :confused:

Great, thanks!

But...

Unfortunately not... :frowning: Really sorry about that. You would have to avoid
this construct (in any context where the type might not be deduced
immediately - so any class template or an out of line definition of an auto
return type function). In those places you can still use a late return type
specification ("auto x() -> foo").