]> granicus.if.org Git - clang/commit
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)
commitb5b37d194dddb960f43f763b3f9c3e17e7be3c2d
tree19592ee7bc4349dd793b866c58a51c9be91d8f0b
parent4ec429d1be4ede3d02712714f20470b2c87f748c
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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166455 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaTemplateInstantiateDecl.cpp
test/SemaCXX/libstdcxx_common_type_hack.cpp [new file with mode: 0644]
www/cxx_status.html