Bug 51185 - [C++0x] false-positive results of std::is_constructible
Summary: [C++0x] false-positive results of std::is_constructible
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-17 07:19 UTC by Ai Azuma
Modified: 2011-11-22 21:50 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-11-17 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ai Azuma 2011-11-17 07:19:21 UTC
All of the static_asserts in the following code result in compile error with -std=c++11.


////////////////////////////////////////
#include <type_traits>

struct A{};
struct B : A{};

int main()
{
  static_assert(!std::is_constructible<B &&, A>(), "");
  static_assert(!std::is_constructible<B const &&, A>(), "");
  static_assert(!std::is_constructible<B const &&, A const>(), "");
  static_assert(!std::is_constructible<B volatile &&, A>(), "");
  static_assert(!std::is_constructible<B volatile &&, A volatile>(), "");
  static_assert(!std::is_constructible<B const volatile &&, A>(), "");
  static_assert(!std::is_constructible<B const volatile &&, A const>(), "");
  static_assert(!std::is_constructible<B const volatile &&, A volatile>(), "");
  static_assert(!std::is_constructible<B const volatile &&, A const volatile>(), "");
}
////////////////////////////////////////
Comment 1 Paolo Carlini 2011-11-17 10:18:19 UTC
Daniel, can you have a look?
Comment 2 Daniel Krügler 2011-11-17 10:58:09 UTC
(In reply to comment #1)
The root of the problem is that __is_base_to_derived_ref works on source references solely. I need a bit time for a proper fix.
Comment 3 Paolo Carlini 2011-11-17 11:14:59 UTC
Thanks a lot!
Comment 4 paolo@gcc.gnu.org 2011-11-21 11:21:20 UTC
Author: paolo
Date: Mon Nov 21 11:21:13 2011
New Revision: 181557

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181557
Log:
2011-11-21  Daniel Krugler  <daniel.kruegler@googlemail.com>

	PR libstdc++/51185
	* include/std/type_traits (__is_base_to_derived_ref,
	__is_lvalue_to_rvalue_ref): Fix.
	* testsuite/20_util/is_constructible/51185.cc: New.
	* testsuite/20_util/is_constructible/value-2.cc: Extend.

Added:
    trunk/libstdc++-v3/testsuite/20_util/is_constructible/51185.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/std/type_traits
    trunk/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
    trunk/libstdc++-v3/testsuite/20_util/is_constructible/value-2.cc
    trunk/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
    trunk/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
Comment 5 Paolo Carlini 2011-11-21 11:24:27 UTC
Fixed.