public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/39880] New: Specialisation is_error_code_enum<errc> should not exist
@ 2009-04-24 9:32 chris_kohlhoff at internet-mail dot org
2009-04-25 9:14 ` [Bug libstdc++/39880] " paolo dot carlini at oracle dot com
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: chris_kohlhoff at internet-mail dot org @ 2009-04-24 9:32 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1265 bytes --]
The system_error header incorrectly provides the specialisation:
template<>
struct is_error_code_enum<errc>
: public true_type { };
Only is_error_condition_enum<errc> should be specialised. The spurious
specialisation causes the following code to fail to compile:
#include <system_error>
int main()
{
std::error_code ec;
if (ec == std::errc::not_supported)
;
}
with error:
a.cpp: In function âint main()â:
a.cpp:6: error: ambiguous overload for âoperator==â in âec == (std::errc)95â
/usr/include/c++/4.4/system_error:279: note: candidates are: bool
std::operator==(const std::error_code&, const std::error_condition&)
/usr/include/c++/4.4/system_error:274: note: bool
std::operator==(const std::error_code&, const std::error_code&)
Expected result: code should compile without warning or error.
--
Summary: Specialisation is_error_code_enum<errc> should not exist
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: chris_kohlhoff at internet-mail dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39880
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/39880] Specialisation is_error_code_enum<errc> should not exist
2009-04-24 9:32 [Bug libstdc++/39880] New: Specialisation is_error_code_enum<errc> should not exist chris_kohlhoff at internet-mail dot org
@ 2009-04-25 9:14 ` paolo dot carlini at oracle dot com
2009-04-25 9:52 ` paolo dot carlini at oracle dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-25 9:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paolo dot carlini at oracle dot com 2009-04-25 09:13 -------
Agreed. This is going to change a lot with concepts, of course, but in the old
n2521 for instance the specialization doesn't exist indeed.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |paolo dot carlini at oracle
|dot org |dot com
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-04-25 09:13:53
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39880
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/39880] Specialisation is_error_code_enum<errc> should not exist
2009-04-24 9:32 [Bug libstdc++/39880] New: Specialisation is_error_code_enum<errc> should not exist chris_kohlhoff at internet-mail dot org
2009-04-25 9:14 ` [Bug libstdc++/39880] " paolo dot carlini at oracle dot com
@ 2009-04-25 9:52 ` paolo dot carlini at oracle dot com
2009-04-25 11:03 ` chris_kohlhoff at internet-mail dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-25 9:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from paolo dot carlini at oracle dot com 2009-04-25 09:52 -------
If we do this, I don't see how the error_code constructor and assignment
operator taking an ErrorCodeEnum can be made to work, that this how they can
actually accept a std::errc (I'm referring to n2723 and n2798, basically).
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39880
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/39880] Specialisation is_error_code_enum<errc> should not exist
2009-04-24 9:32 [Bug libstdc++/39880] New: Specialisation is_error_code_enum<errc> should not exist chris_kohlhoff at internet-mail dot org
2009-04-25 9:14 ` [Bug libstdc++/39880] " paolo dot carlini at oracle dot com
2009-04-25 9:52 ` paolo dot carlini at oracle dot com
@ 2009-04-25 11:03 ` chris_kohlhoff at internet-mail dot org
2009-04-25 11:13 ` paolo dot carlini at oracle dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: chris_kohlhoff at internet-mail dot org @ 2009-04-25 11:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from chris_kohlhoff at internet-mail dot org 2009-04-25 11:03 -------
It's the intended behaviour that the conversion constructor and assignment
operator be disabled. That is, the std::errc type should not be implicitly
convertible to error_code, only to error_condition.
If users want to create an error_code from a std::errc then they can use
make_error_code():
error_code ec = make_error_code(errc::not_supported);
In a nutshell, ErrorConditionEnum concept means implicitly convertible to
error_condition but no implicit conversion to error_code. Likewise
ErrorCodeEnum means implicitly convertible to error_code but not to
error_condition.
(N.B. bugs 39881 and 39882 also have to be fixed to make this conversion work.)
--
chris_kohlhoff at internet-mail dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39880
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/39880] Specialisation is_error_code_enum<errc> should not exist
2009-04-24 9:32 [Bug libstdc++/39880] New: Specialisation is_error_code_enum<errc> should not exist chris_kohlhoff at internet-mail dot org
` (2 preceding siblings ...)
2009-04-25 11:03 ` chris_kohlhoff at internet-mail dot org
@ 2009-04-25 11:13 ` paolo dot carlini at oracle dot com
2009-04-25 19:01 ` paolo at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-25 11:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from paolo dot carlini at oracle dot com 2009-04-25 11:13 -------
Ok, then it's easy.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39880
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/39880] Specialisation is_error_code_enum<errc> should not exist
2009-04-24 9:32 [Bug libstdc++/39880] New: Specialisation is_error_code_enum<errc> should not exist chris_kohlhoff at internet-mail dot org
` (3 preceding siblings ...)
2009-04-25 11:13 ` paolo dot carlini at oracle dot com
@ 2009-04-25 19:01 ` paolo at gcc dot gnu dot org
2009-04-25 19:03 ` paolo at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: paolo at gcc dot gnu dot org @ 2009-04-25 19:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from paolo at gcc dot gnu dot org 2009-04-25 19:01 -------
Subject: Bug 39880
Author: paolo
Date: Sat Apr 25 19:00:52 2009
New Revision: 146780
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146780
Log:
2009-04-25 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/39880
PR libstdc++/39881
PR libstdc++/39882
* include/std/system_error (is_error_code_enum<errc>): Remove.
(error_condition<>::error_condition(_ErrorCodeEnum,)
error_condition<>::operator=(_ErrorCodeEnum)): Use
make_error_condition.
(error_code<>::error_code(_ErrorCodeEnum,),
error_code<>::operator=(_ErrorCodeEnum)): Use make_error_code.
* testsuite/19_diagnostics/system_error/39880.cc: New.
* testsuite/19_diagnostics/error_condition/modifiers/39881.cc:
Likewise.
* testsuite/19_diagnostics/error_condition/cons/39881.cc: Likewise.
* testsuite/19_diagnostics/error_code/modifiers/39882.cc: Likewise.
* testsuite/19_diagnostics/error_code/cons/39882.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc:
Adjust.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc:
Likewise.
* testsuite/19_diagnostics/error_code/cons/1.cc: Likewise.
* testsuite/19_diagnostics/error_code/operators/bool.cc: Likewise.
* testsuite/19_diagnostics/error_code/operators/equal.cc: Likewise.
* testsuite/19_diagnostics/error_code/operators/not_equal.cc:
Likewise.
* testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Likewise.
* testsuite/19_diagnostics/system_error/cons-1.cc: Likewise.
* testsuite/19_diagnostics/system_error/what-4.cc: Likewise.
* testsuite/30_threads/unique_lock/locking/2.cc: Likewise.
Added:
trunk/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/39882.cc
trunk/libstdc++-v3/testsuite/19_diagnostics/error_code/modifiers/
trunk/libstdc++-v3/testsuite/19_diagnostics/error_code/modifiers/39882.cc
trunk/libstdc++-v3/testsuite/19_diagnostics/error_condition/cons/39881.cc
trunk/libstdc++-v3/testsuite/19_diagnostics/error_condition/modifiers/
trunk/libstdc++-v3/testsuite/19_diagnostics/error_condition/modifiers/39881.cc
trunk/libstdc++-v3/testsuite/19_diagnostics/system_error/39880.cc
Modified:
trunk/libstdc++-v3/include/std/system_error
trunk/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc
trunk/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc
trunk/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc
trunk/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc
trunk/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc
trunk/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc
trunk/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc
trunk/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc
trunk/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc
trunk/libstdc++-v3/testsuite/30_threads/unique_lock/locking/2.cc
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39880
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/39880] Specialisation is_error_code_enum<errc> should not exist
2009-04-24 9:32 [Bug libstdc++/39880] New: Specialisation is_error_code_enum<errc> should not exist chris_kohlhoff at internet-mail dot org
` (4 preceding siblings ...)
2009-04-25 19:01 ` paolo at gcc dot gnu dot org
@ 2009-04-25 19:03 ` paolo at gcc dot gnu dot org
2009-04-28 10:33 ` paolo at gcc dot gnu dot org
2009-04-28 10:35 ` paolo dot carlini at oracle dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo at gcc dot gnu dot org @ 2009-04-25 19:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from paolo at gcc dot gnu dot org 2009-04-25 19:02 -------
Subject: Bug 39880
Author: paolo
Date: Sat Apr 25 19:02:17 2009
New Revision: 146781
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146781
Log:
2009-04-25 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/39880
PR libstdc++/39881
PR libstdc++/39882
* include/std/system_error (is_error_code_enum<errc>): Remove.
(error_condition<>::error_condition(_ErrorCodeEnum,)
error_condition<>::operator=(_ErrorCodeEnum)): Use
make_error_condition.
(error_code<>::error_code(_ErrorCodeEnum,),
error_code<>::operator=(_ErrorCodeEnum)): Use make_error_code.
* testsuite/19_diagnostics/system_error/39880.cc: New.
* testsuite/19_diagnostics/error_condition/modifiers/39881.cc:
Likewise.
* testsuite/19_diagnostics/error_condition/cons/39881.cc: Likewise.
* testsuite/19_diagnostics/error_code/modifiers/39882.cc: Likewise.
* testsuite/19_diagnostics/error_code/cons/39882.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc:
Adjust.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc:
Likewise.
* testsuite/19_diagnostics/error_code/cons/1.cc: Likewise.
* testsuite/19_diagnostics/error_code/operators/bool.cc: Likewise.
* testsuite/19_diagnostics/error_code/operators/equal.cc: Likewise.
* testsuite/19_diagnostics/error_code/operators/not_equal.cc:
Likewise.
* testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Likewise.
* testsuite/19_diagnostics/system_error/cons-1.cc: Likewise.
* testsuite/19_diagnostics/system_error/what-4.cc: Likewise.
* testsuite/30_threads/unique_lock/locking/2.cc: Likewise.
Modified:
trunk/libstdc++-v3/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39880
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/39880] Specialisation is_error_code_enum<errc> should not exist
2009-04-24 9:32 [Bug libstdc++/39880] New: Specialisation is_error_code_enum<errc> should not exist chris_kohlhoff at internet-mail dot org
` (5 preceding siblings ...)
2009-04-25 19:03 ` paolo at gcc dot gnu dot org
@ 2009-04-28 10:33 ` paolo at gcc dot gnu dot org
2009-04-28 10:35 ` paolo dot carlini at oracle dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo at gcc dot gnu dot org @ 2009-04-28 10:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from paolo at gcc dot gnu dot org 2009-04-28 10:32 -------
Subject: Bug 39880
Author: paolo
Date: Tue Apr 28 10:32:22 2009
New Revision: 146886
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146886
Log:
2009-04-28 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/39880
PR libstdc++/39881
PR libstdc++/39882
* include/std/system_error (is_error_code_enum<errc>): Remove.
(error_condition<>::error_condition(_ErrorCodeEnum,)
error_condition<>::operator=(_ErrorCodeEnum)): Use
make_error_condition.
(error_code<>::error_code(_ErrorCodeEnum,),
error_code<>::operator=(_ErrorCodeEnum)): Use make_error_code.
* testsuite/19_diagnostics/system_error/39880.cc: New.
* testsuite/19_diagnostics/error_condition/modifiers/39881.cc:
Likewise.
* testsuite/19_diagnostics/error_condition/cons/39881.cc: Likewise.
* testsuite/19_diagnostics/error_code/modifiers/39882.cc: Likewise.
* testsuite/19_diagnostics/error_code/cons/39882.cc: Likewise.
* testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc:
Adjust.
* testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc:
Likewise.
* testsuite/19_diagnostics/error_code/cons/1.cc: Likewise.
* testsuite/19_diagnostics/error_code/operators/bool.cc: Likewise.
* testsuite/19_diagnostics/error_code/operators/equal.cc: Likewise.
* testsuite/19_diagnostics/error_code/operators/not_equal.cc:
Likewise.
* testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Likewise.
* testsuite/19_diagnostics/system_error/cons-1.cc: Likewise.
* testsuite/19_diagnostics/system_error/what-4.cc: Likewise.
* testsuite/30_threads/unique_lock/locking/2.cc: Likewise.
Added:
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/39882.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/error_code/modifiers/
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/error_code/modifiers/39882.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/error_condition/cons/39881.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/error_condition/modifiers/
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/error_condition/modifiers/39881.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/system_error/39880.cc
Modified:
branches/gcc-4_4-branch/libstdc++-v3/ChangeLog
branches/gcc-4_4-branch/libstdc++-v3/include/std/system_error
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc
branches/gcc-4_4-branch/libstdc++-v3/testsuite/30_threads/unique_lock/locking/2.cc
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39880
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug libstdc++/39880] Specialisation is_error_code_enum<errc> should not exist
2009-04-24 9:32 [Bug libstdc++/39880] New: Specialisation is_error_code_enum<errc> should not exist chris_kohlhoff at internet-mail dot org
` (6 preceding siblings ...)
2009-04-28 10:33 ` paolo at gcc dot gnu dot org
@ 2009-04-28 10:35 ` paolo dot carlini at oracle dot com
7 siblings, 0 replies; 9+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-04-28 10:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from paolo dot carlini at oracle dot com 2009-04-28 10:34 -------
Fixed for 4.4.1.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.4.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39880
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-04-28 10:34 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-24 9:32 [Bug libstdc++/39880] New: Specialisation is_error_code_enum<errc> should not exist chris_kohlhoff at internet-mail dot org
2009-04-25 9:14 ` [Bug libstdc++/39880] " paolo dot carlini at oracle dot com
2009-04-25 9:52 ` paolo dot carlini at oracle dot com
2009-04-25 11:03 ` chris_kohlhoff at internet-mail dot org
2009-04-25 11:13 ` paolo dot carlini at oracle dot com
2009-04-25 19:01 ` paolo at gcc dot gnu dot org
2009-04-25 19:03 ` paolo at gcc dot gnu dot org
2009-04-28 10:33 ` paolo at gcc dot gnu dot org
2009-04-28 10:35 ` paolo dot carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).