* [Bug libstdc++/44969] [C++0x] <type_traits> std::is_constructible broken for fundamental types.
2010-07-17 0:01 [Bug libstdc++/44969] New: [C++0x] <type_traits> std::is_constructible broken for fundamental types piotr dot rak at gmail dot com
@ 2010-07-17 0:03 ` piotr dot rak at gmail dot com
2010-07-17 0:56 ` paolo dot carlini at oracle dot com
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: piotr dot rak at gmail dot com @ 2010-07-17 0:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from piotr dot rak at gmail dot com 2010-07-17 00:03 -------
Created an attachment (id=21233)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21233&action=view)
Testcase
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44969
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libstdc++/44969] [C++0x] <type_traits> std::is_constructible broken for fundamental types.
2010-07-17 0:01 [Bug libstdc++/44969] New: [C++0x] <type_traits> std::is_constructible broken for fundamental types piotr dot rak at gmail dot com
2010-07-17 0:03 ` [Bug libstdc++/44969] " piotr dot rak at gmail dot com
@ 2010-07-17 0:56 ` paolo dot carlini at oracle dot com
2010-07-17 19:05 ` [Bug c++/44969] " paolo dot carlini at oracle dot com
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-07-17 0:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from paolo dot carlini at oracle dot com 2010-07-17 00:56 -------
I don't think this is a library issue, the implementation is straightforward.
The below C++03 snippet already shows the problem, is rejected (ICC likes it).
Jason, can you have a look to this one too?
////////////////
template<bool, typename T = void> struct enable_if { typedef T type; };
template<typename T> struct enable_if<false, T> { };
template<typename Tp, typename Arg1, typename Arg2>
class mini_is_constructible
{
typedef char one;
typedef struct { char arr[2]; } two;
template<typename Tp1, typename Arg1_, typename Arg2_>
static typename
enable_if<(sizeof(Tp1(Arg1_(), Arg2_()), 1) > 0), one>::type
test(int);
template<typename, typename, typename>
static two test(...);
public:
static const bool value = sizeof(test<Tp, Arg1, Arg2>(0)) == 1;
};
class A { };
int Test[mini_is_constructible<int, A, A>::value ? -1 : 1];
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44969
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/44969] [C++0x] <type_traits> std::is_constructible broken for fundamental types.
2010-07-17 0:01 [Bug libstdc++/44969] New: [C++0x] <type_traits> std::is_constructible broken for fundamental types piotr dot rak at gmail dot com
2010-07-17 0:03 ` [Bug libstdc++/44969] " piotr dot rak at gmail dot com
2010-07-17 0:56 ` paolo dot carlini at oracle dot com
@ 2010-07-17 19:05 ` paolo dot carlini at oracle dot com
2010-07-17 19:14 ` paolo dot carlini at oracle dot com
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-07-17 19:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from paolo dot carlini at oracle dot com 2010-07-17 19:05 -------
Created an attachment (id=21236)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21236&action=view)
Draft patch for the original testcase
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44969
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/44969] [C++0x] <type_traits> std::is_constructible broken for fundamental types.
2010-07-17 0:01 [Bug libstdc++/44969] New: [C++0x] <type_traits> std::is_constructible broken for fundamental types piotr dot rak at gmail dot com
` (2 preceding siblings ...)
2010-07-17 19:05 ` [Bug c++/44969] " paolo dot carlini at oracle dot com
@ 2010-07-17 19:14 ` paolo dot carlini at oracle dot com
2010-07-17 19:14 ` paolo dot carlini at oracle dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-07-17 19:14 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]
------- Comment #4 from paolo dot carlini at oracle dot com 2010-07-17 19:14 -------
I attached a draft which fixes the original testcase as a SFINAE issue. Seems
to me rather straightforward and consistent with existing practice in typeck.c,
just passes down complain to build_x_compound_expr_from_list. Regtests fine.
However, the reduced testcase I attached, using enable_if instead of decltype,
is not fixed by it. In that case the error, of the form:
a.cc:19:66: error: invalid use of template type parameter Arg1_
a.cc:19:66: error: invalid use of template type parameter Arg2_
a.cc:19:66: error: invalid use of template type parameter Tp1
come from cxx_incomplete_type_diagnostic, called by complete_type_or_else,
called in turn by build_functional_cast:1609, where it does:
if (!complete_type_or_else (type, NULL_TREE))
return error_mark_node;
irrespective of complain. Jason, should complete_type_or_else be something
different when tf_none?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44969
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/44969] [C++0x] <type_traits> std::is_constructible broken for fundamental types.
2010-07-17 0:01 [Bug libstdc++/44969] New: [C++0x] <type_traits> std::is_constructible broken for fundamental types piotr dot rak at gmail dot com
` (3 preceding siblings ...)
2010-07-17 19:14 ` paolo dot carlini at oracle dot com
@ 2010-07-17 19:14 ` paolo dot carlini at oracle dot com
2010-07-17 20:54 ` jason at redhat dot com
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-07-17 19:14 UTC (permalink / raw)
To: gcc-bugs
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-07-17 19:14:09
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44969
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/44969] [C++0x] <type_traits> std::is_constructible broken for fundamental types.
2010-07-17 0:01 [Bug libstdc++/44969] New: [C++0x] <type_traits> std::is_constructible broken for fundamental types piotr dot rak at gmail dot com
` (4 preceding siblings ...)
2010-07-17 19:14 ` paolo dot carlini at oracle dot com
@ 2010-07-17 20:54 ` jason at redhat dot com
2010-07-17 21:10 ` paolo dot carlini at oracle dot com
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jason at redhat dot com @ 2010-07-17 20:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jason at redhat dot com 2010-07-17 20:53 -------
Subject: Re: [C++0x] <type_traits> std::is_constructible broken
for fundamental types.
> irrespective of complain. Jason, should complete_type_or_else be something
> different when tf_none?
Perhaps, but we shouldn't be dealing with template parameters there
anyway; they should have been substituted away by this point. I'm
investigating.
Jason
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44969
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/44969] [C++0x] <type_traits> std::is_constructible broken for fundamental types.
2010-07-17 0:01 [Bug libstdc++/44969] New: [C++0x] <type_traits> std::is_constructible broken for fundamental types piotr dot rak at gmail dot com
` (5 preceding siblings ...)
2010-07-17 20:54 ` jason at redhat dot com
@ 2010-07-17 21:10 ` paolo dot carlini at oracle dot com
2010-07-18 22:33 ` jason at redhat dot com
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-07-17 21:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from paolo dot carlini at oracle dot com 2010-07-17 21:09 -------
Great, thanks a lot.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44969
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/44969] [C++0x] <type_traits> std::is_constructible broken for fundamental types.
2010-07-17 0:01 [Bug libstdc++/44969] New: [C++0x] <type_traits> std::is_constructible broken for fundamental types piotr dot rak at gmail dot com
` (6 preceding siblings ...)
2010-07-17 21:10 ` paolo dot carlini at oracle dot com
@ 2010-07-18 22:33 ` jason at redhat dot com
2010-07-19 9:38 ` paolo dot carlini at oracle dot com
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jason at redhat dot com @ 2010-07-18 22:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jason at redhat dot com 2010-07-18 22:33 -------
Subject: Re: [C++0x] <type_traits> std::is_constructible broken
for fundamental types.
On 07/17/2010 03:14 PM, paolo dot carlini at oracle dot com wrote:
> I attached a draft which fixes the original testcase as a SFINAE issue. Seems
> to me rather straightforward and consistent with existing practice in typeck.c,
> just passes down complain to build_x_compound_expr_from_list. Regtests fine.
Looks good. I haven't tracked down the other issue yet.
Jason
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44969
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/44969] [C++0x] <type_traits> std::is_constructible broken for fundamental types.
2010-07-17 0:01 [Bug libstdc++/44969] New: [C++0x] <type_traits> std::is_constructible broken for fundamental types piotr dot rak at gmail dot com
` (7 preceding siblings ...)
2010-07-18 22:33 ` jason at redhat dot com
@ 2010-07-19 9:38 ` paolo dot carlini at oracle dot com
2010-07-19 10:28 ` paolo at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-07-19 9:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from paolo dot carlini at oracle dot com 2010-07-19 09:38 -------
OK, I'm committing my bits and leaving the PR open for you to investigate the
second issue (PS: I noticed an ICE on invalid while quickly hacking the
testcase, if I figure out isn't a duplicate I'll file a separate PR asap)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44969
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/44969] [C++0x] <type_traits> std::is_constructible broken for fundamental types.
2010-07-17 0:01 [Bug libstdc++/44969] New: [C++0x] <type_traits> std::is_constructible broken for fundamental types piotr dot rak at gmail dot com
` (8 preceding siblings ...)
2010-07-19 9:38 ` paolo dot carlini at oracle dot com
@ 2010-07-19 10:28 ` paolo at gcc dot gnu dot org
2010-07-19 14:51 ` jason at gcc dot gnu dot org
2010-07-20 9:29 ` paolo dot carlini at oracle dot com
11 siblings, 0 replies; 13+ messages in thread
From: paolo at gcc dot gnu dot org @ 2010-07-19 10:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from paolo at gcc dot gnu dot org 2010-07-19 10:28 -------
Subject: Bug 44969
Author: paolo
Date: Mon Jul 19 10:27:58 2010
New Revision: 162303
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162303
Log:
/cp
2010-07-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/44969
* typeck.c (build_x_compound_expr_from_list): Add tsubst_flags_t
parameter.
* cp-tree.h: Adjust declaration.
* init.c (perform_member_init): Adjust caller.
* decl.c (grok_reference_init, cp_finish_decl): Likewise.
* typeck2.c (store_init_value): Likewise.
(build_functional_cast): Pass complain argument to
build_x_compound_expr_from_list.
/testsuite
2010-07-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/44969
* g++.dg/template/sfinae23.C: New.
Added:
trunk/gcc/testsuite/g++.dg/template/sfinae23.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/decl.c
trunk/gcc/cp/init.c
trunk/gcc/cp/typeck.c
trunk/gcc/cp/typeck2.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44969
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/44969] [C++0x] <type_traits> std::is_constructible broken for fundamental types.
2010-07-17 0:01 [Bug libstdc++/44969] New: [C++0x] <type_traits> std::is_constructible broken for fundamental types piotr dot rak at gmail dot com
` (9 preceding siblings ...)
2010-07-19 10:28 ` paolo at gcc dot gnu dot org
@ 2010-07-19 14:51 ` jason at gcc dot gnu dot org
2010-07-20 9:29 ` paolo dot carlini at oracle dot com
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu dot org @ 2010-07-19 14:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jason at gcc dot gnu dot org 2010-07-19 14:51 -------
Subject: Bug 44969
Author: jason
Date: Mon Jul 19 14:50:52 2010
New Revision: 162307
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162307
Log:
PR c++/44969
* tree.c (cp_tree_equal): Compare type of *CAST_EXPR.
* pt.c (iterative_hash_template_arg): Hash type of *CAST_EXPR.
Added:
trunk/gcc/testsuite/g++.dg/template/sfinae24.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
trunk/gcc/cp/tree.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44969
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/44969] [C++0x] <type_traits> std::is_constructible broken for fundamental types.
2010-07-17 0:01 [Bug libstdc++/44969] New: [C++0x] <type_traits> std::is_constructible broken for fundamental types piotr dot rak at gmail dot com
` (10 preceding siblings ...)
2010-07-19 14:51 ` jason at gcc dot gnu dot org
@ 2010-07-20 9:29 ` paolo dot carlini at oracle dot com
11 siblings, 0 replies; 13+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-07-20 9:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from paolo dot carlini at oracle dot com 2010-07-20 09:29 -------
Fixed for 4.6.0.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.6.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44969
^ permalink raw reply [flat|nested] 13+ messages in thread