public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aleksej.penkov at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/62082] New: cout fails to work with auto variable initialized with curvy brackets
Date: Sun, 10 Aug 2014 14:44:00 -0000	[thread overview]
Message-ID: <bug-62082-4@http.gcc.gnu.org/bugzilla/> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 3471 bytes --]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62082

            Bug ID: 62082
           Summary: cout fails to work with auto variable initialized with
                    curvy brackets
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aleksej.penkov at hotmail dot com

This simple code (compiled with -std=c++11 -Wall):
#include <iostream>

int main()
{
    double d = 5.5;
    auto a {d};

    std::cout<<d<<' '<<a<<std::endl;
}

gives this compilation error:
2.cpp: In function ‘int main()’:
2.cpp:8:14: error: cannot bind ‘std::basic_ostream<char>’ lvalue to
‘std::basic_ostream<char>&&’
  std::cout<<d<<' '<<a<<std::endl;
              ^
In file included from /usr/local/include/c++/4.9.1/iostream:39:0,
                 from 2.cpp:1:
/usr/local/include/c++/4.9.1/ostream:602:5: note: initializing argument 1 of
‘std::basic_ostream<_CharT, _Traits>&
std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT
= char; _Traits = std::char_traits<char>; _Tp = std::initializer_list<double>]’
     operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
     ^

If i replace
auto a {d};
with
auto a = d;

it works fine.
>From gcc-bugs-return-458112-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Aug 10 14:46:18 2014
Return-Path: <gcc-bugs-return-458112-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 10232 invoked by alias); 10 Aug 2014 14:46:18 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 10214 invoked by uid 48); 10 Aug 2014 14:46:13 -0000
From: "aleksej.penkov at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/62082] cout fails to work with auto variable initialized with curvy brackets
Date: Sun, 10 Aug 2014 14:46:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.9.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: aleksej.penkov at hotmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-62082-4-MtZiKH30Sv@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-62082-4@http.gcc.gnu.org/bugzilla/>
References: <bug-62082-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg00609.txt.bz2
Content-length: 240

https://gcc.gnu.org/bugzilla/show_bug.cgi?idb082

--- Comment #1 from Aleksej <aleksej.penkov at hotmail dot com> ---
Created attachment 33284
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id3284&actioníit
source file with issue


             reply	other threads:[~2014-08-10 14:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-10 14:44 aleksej.penkov at hotmail dot com [this message]
2014-08-10 16:57 ` [Bug libstdc++/62082] " daniel.kruegler at googlemail dot com
2014-08-11 10:16 ` aleksej.penkov at hotmail dot com

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-62082-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).