public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/56011] New: [C++11] std::atomic<bool> and std::atomic_bool miss volatile assignment operator overload
Date: Wed, 16 Jan 2013 20:47:00 -0000	[thread overview]
Message-ID: <bug-56011-4@http.gcc.gnu.org/bugzilla/> (raw)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56011

             Bug #: 56011
           Summary: [C++11] std::atomic<bool> and std::atomic_bool miss
                    volatile assignment operator overload
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com


Using gcc 4.8.0 trunk the following program - compiled with the flags

-pedantic-errors -std=c++11 -Wall

is rejected:

//----------------------------------
#include <atomic>

int main() {
  volatile std::atomic<bool> ab1;
  ab1 = true;
  volatile std::atomic_bool ab2;
  ab2 = true;
}
//----------------------------------

"main.cpp||In function 'int main()':|
main.cpp|5|error: ambiguous overload for 'operator=' (operand types are
'volatile std::atomic<bool>' and 'bool')|
main.cpp|5|note: candidates are:|
[..]gcc\include\c++\4.8.0\atomic|485|note: std::atomic<bool>&
std::atomic<bool>::operator=(const std::atomic<bool>&) volatile <deleted>|
[..]gcc\include\c++\4.8.0\atomic|64|note: std::atomic_bool&
std::atomic_bool::operator=(const std::atomic_bool&) volatile <deleted>|
main.cpp|7|error: use of deleted function 'std::atomic_bool&
std::atomic_bool::operator=(const std::atomic_bool&) volatile'|
[..]gcc\include\c++\4.8.0\atomic|64|error: declared here|
"

The problem is due to the missing overload (part of the specification):

bool operator=(bool __i) volatile noexcept;


             reply	other threads:[~2013-01-16 20:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 20:47 daniel.kruegler at googlemail dot com [this message]
2013-01-16 22:31 ` [Bug libstdc++/56011] " redi at gcc dot gnu.org
2013-02-26 23:46 ` redi at gcc dot gnu.org
2013-02-27  0:58 ` redi at gcc dot gnu.org
2013-02-27  0:59 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-56011-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).