Unable to evaluate clang on linux or windows

Hi,
I’d like to try out the new c++11 features using clang. However, I am running into some issue or the other on both Windows and Linux. In both cases, it looks like the problem is due to headers from VC/g++.
I was wondering if someone can point me to some steps on setting up a Windows or Linux(ubuntu 12.04 LTS) box for exploring clang.
I was able to successfully build clang on my ubuntu but that did not help in building my sample CPP files.
Regards,
Kashyap

(switching mailing lists)

Hi,
I'd like to try out the new c++11 features using clang. However, I am
running into some issue or the other on both Windows and Linux. In both
cases, it looks like the problem is due to headers from VC/g++.
I was wondering if someone can point me to some steps on setting up a
Windows or Linux(ubuntu 12.04 LTS) box for exploring clang.

I'm running ToT Clang with Ubuntu 12.04 LTS and seem to be self-hosting
just fine (ie: I can build all of Clang with Clang, etc)

It might help if you give us the compiler error and version of clang
you've compiled.

I can compile C++ programs with libstdc++ or libc++ without issue.

Windows support is experimental at the moment, so let's stick with
Ubuntu for now.

Ben

Sorry … I missed mentioning the details -

this is the error I get -

root@no1slu398:~/Documents/LLVM/tmp# clang++ -std=c++0x hello.cpp
In file included from hello.cpp:1:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.6/…/…/…/…/include/c++/4.6/thread:38:
/usr/lib/gcc/x86_64-linux-gnu/4.6/…/…/…/…/include/c++/4.6/chrono:535:6: error: no matching constructor for initialization of ‘duration’ (aka
‘std::chrono::duration<long, std::ratio<1, 1000000> >’)
: __d(__t.time_since_epoch())
^ ~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/4.6/…/…/…/…/include/c++/4.6/condition_variable:106:42: note: in instantiation of function template specialization
‘std::chrono::time_point<std::chrono::system_clock, std::chrono::duration<long, std::ratio<1, 1000000> > >::time_point<std::chrono::duration<long,
std::ratio<1, 1000000000> > >’ requested here
const __clock_t::time_point __s_atime = __s_entry + __delta;
^
/usr/lib/gcc/x86_64-linux-gnu/4.6/…/…/…/…/include/c++/4.6/chrono:234:12: note: candidate constructor not viable: no known conversion from
‘duration<[…], ratio<[…], 1000000000>>’ to ‘const duration<[…], ratio<[…], 1000000>>’ for 1st argument
constexpr duration(const duration&) = default;
^
/usr/lib/gcc/x86_64-linux-gnu/4.6/…/…/…/…/include/c++/4.6/chrono:237:19: note: candidate template ignored: disabled by ‘enable_if’ [with _Rep2 =
std::chrono::duration<long, std::ratio<1, 1000000000> >]
enable_if<is_convertible<_Rep2, rep>::value
^
/usr/lib/gcc/x86_64-linux-gnu/4.6/…/…/…/…/include/c++/4.6/chrono:244:19: note: candidate template ignored: disabled by ‘enable_if’ [with _Rep2 = long, _Period2
= std::ratio<1, 1000000000>]
enable_if<treat_as_floating_point::value
^
/usr/lib/gcc/x86_64-linux-gnu/4.6/…/…/…/…/include/c++/4.6/chrono:232:12: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
constexpr duration() : __r() { }
^
1 error generated.
root@no1slu398:~/Documents/LLVM/tmp# cat hello.cpp
#include

int main() {
return 0;
}

Regards,
Kashyap

Hi,
I’d really appreciate some pointers in this regard.
Regards,
Kashyap

I think there might be something wrong with your installation.

clang++ -std=c++0x hello.cpp
clang++ -std=c++11 hello.cpp

Both works fine here and creates an exe a.out

Which version of clang/llvm are you using?

C K Kashyap <ckkashyap@gmail.com> writes:

I'd really appreciate some pointers in this regard.

Possibly gcc 4.6 libstdc++ is incompatible with Clang's C++11 mode. I
remember having problems with Clang, C++11 and libstdc++ until some
Kubuntu release "fixed" them.

[Dropping llvmdev via BCC, moving to cfe-dev]

This is a bug in libstdc++. More information and a patch to fix it here: http://gcc.gnu.org/PR53841