Ugly ugly hack for libstdc++-4.6 and libstdc++-4.7 compatibility. These
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 23 Oct 2012 00:32:41 +0000 (00:32 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 23 Oct 2012 00:32:41 +0000 (00:32 +0000)
commit2ddcbab8ff9cf1c41ddb287145b101aa97a027ae
tree1adc8c93d29d7157edd79ea7b39988cb453fe089
parentd7fa5e420d933dc2b354ff307e1344e380e45d01
Ugly ugly hack for libstdc++-4.6 and libstdc++-4.7 compatibility. These
libraries have an incorrect definition of std::common_type (inherited from a
bug in the standard -- see LWG issue 2141), whereby they produce reference
types when they should not.

If we instantiate a typedef named std::common_type<...>::type, which is defined
in a system header as decltype(... ? ... : ...), and the decltype produces a
reference type, convert it to the non-reference type. (This doesn't affect any
LWG2141-conforming implementation of common_type, such as libc++'s, because the
default implementation of common_type<...>::type isn't supposed to produce a
reference type.)

This is horrible. I'm really sorry. :( Better ideas appreciated!

llvm-svn: 166455
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/SemaCXX/libstdcxx_common_type_hack.cpp [new file with mode: 0644]
clang/www/cxx_status.html