public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66771] New: [5 Regression] -std=c++11 doesn't work
@ 2015-07-05 20:39 hjl.tools at gmail dot com
  2015-07-05 20:59 ` [Bug c++/66771] [5/6 " hjl.tools at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-07-05 20:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66771
           Summary: [5 Regression] -std=c++11 doesn't work
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

On Linux/x86-64, GCC 5 failed to compile 450.soplex in SPEC CPU 2006:

[hjl@gnu-ivb-1 build_base_lnx32e-gcc.0000]$ g++ -c -o mpsinput.o -DSPEC_CPU
-DNDEBUG   -O2 -ffast-math    -DSPEC_CPU_LP64  -fno-strict-aliasing     
mpsinput.cc -std=c++11  
mpsinput.cc: In member function \u2018bool soplex::MPSInput::readLine()\u2019:
mpsinput.cc:75:52: error: no match for \u2018operator==\u2019 (operand types
are \u2018std::basic_istream<char>::__istream_type {aka
std::basic_istream<char>}\u2019 and \u2018int\u2019)
          if (m_input.getline(m_buf, sizeof(m_buf)) == 0)
                                                    ^
mpsinput.cc:75:52: note: candidate: operator==(int, int) <built-in>
mpsinput.cc:75:52: note:   no known conversion for argument 1 from
\u2018std::basic_istream<char>::__istream_type {aka
std::basic_istream<char>}\u2019 to \u2018int\u2019
In file included from /usr/include/c++/5.1.1/bits/locale_conv.h:41:0,
                 from /usr/include/c++/5.1.1/locale:43,
                 from /usr/include/c++/5.1.1/iomanip:43,
                 from spxlp.h:28,
                 from mpsinput.h:25,
                 from mpsinput.cc:29:
/usr/include/c++/5.1.1/bits/unique_ptr.h:635:5: note: candidate: template<class
_Tp, class _Dp> bool std::operator==(std::nullptr_t, const std::unique_ptr<_Tp,
_Dp>&)
     operator==(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) noexcept
     ^
/usr/include/c++/5.1.1/bits/unique_ptr.h:635:5: note:   template argument
deduction/substitution failed:
mpsinput.cc:75:29: note:   cannot convert
\u2018(&((soplex::MPSInput*)this)->soplex::MPSInput::m_input)->std::basic_istream<_CharT,
_Traits>::getline<char, std::char_traits<char>
>(((char*)(&((soplex::MPSInput*)this)->soplex::MPSInput::m_buf)),
((std::streamsize)sizeof
(((soplex::MPSInput*)this)->soplex::MPSInput::m_buf)))\u2019 (type
\u2018std::basic_istream<char>::__istream_type {aka
std::basic_istream<char>}\u2019) to type \u2018std::nullptr_t\u2019
          if (m_input.getline(m_buf, sizeof(m_buf)) == 0)
                             ^
In file included from /usr/include/c++/5.1.1/bits/locale_conv.h:41:0,
                 from /usr/include/c++/5.1.1/locale:43,
                 from /usr/include/c++/5.1.1/iomanip:43,
                 from spxlp.h:28,
                 from mpsinput.h:25,
                 from mpsinput.cc:29:
/usr/include/c++/5.1.1/bits/unique_ptr.h:630:5: note: candidate: template<class
_Tp, class _Dp> bool std::operator==(const std::unique_ptr<_Tp, _Dp>&,
std::nullptr_t)
     operator==(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) noexcept
     ^
/usr/include/c++/5.1.1/bits/unique_ptr.h:630:5: note:   template argument
deduction/substitution failed:
mpsinput.cc:75:55: note:   \u2018std::basic_istream<char>::__istream_type {aka
std::basic_istream<char>}\u2019 is not derived from \u2018const
std::unique_ptr<_Tp, _Dp>\u2019
          if (m_input.getline(m_buf, sizeof(m_buf)) == 0)
                                                       ^
In file included from /usr/include/c++/5.1.1/bits/locale_conv.h:41:0,
                 from /usr/include/c++/5.1.1/locale:43,
                 from /usr/include/c++/5.1.1/iomanip:43,
                 from spxlp.h:28,
                 from mpsinput.h:25,
                 from mpsinput.cc:29:
/usr/include/c++/5.1.1/bits/unique_ptr.h:624:5: note: candidate: template<class
_Tp, class _Dp, class _Up, class _Ep> bool std::operator==(const
std::unique_ptr<_Tp, _Dp>&, const std::unique_ptr<_Up, _Ep>&)
     operator==(const unique_ptr<_Tp, _Dp>& __x,
...

GCC 4.9 and GCC 6 are OK.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/66771] [5/6 Regression] -std=c++11 doesn't work
  2015-07-05 20:39 [Bug c++/66771] New: [5 Regression] -std=c++11 doesn't work hjl.tools at gmail dot com
@ 2015-07-05 20:59 ` hjl.tools at gmail dot com
  2015-07-06  0:55 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-07-05 20:59 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-07-05
      Known to work|6.0                         |
            Version|6.0                         |5.1.1
   Target Milestone|---                         |5.2
            Summary|[5 Regression] -std=c++11   |[5/6 Regression] -std=c++11
                   |doesn't work                |doesn't work
     Ever confirmed|0                           |1
      Known to fail|                            |6.0

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
GCC 6 also failed.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/66771] [5/6 Regression] -std=c++11 doesn't work
  2015-07-05 20:39 [Bug c++/66771] New: [5 Regression] -std=c++11 doesn't work hjl.tools at gmail dot com
  2015-07-05 20:59 ` [Bug c++/66771] [5/6 " hjl.tools at gmail dot com
@ 2015-07-06  0:55 ` hjl.tools at gmail dot com
  2015-07-06  1:13 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-07-06  0:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
It was caused by r215571.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/66771] [5/6 Regression] -std=c++11 doesn't work
  2015-07-05 20:39 [Bug c++/66771] New: [5 Regression] -std=c++11 doesn't work hjl.tools at gmail dot com
  2015-07-05 20:59 ` [Bug c++/66771] [5/6 " hjl.tools at gmail dot com
  2015-07-06  0:55 ` hjl.tools at gmail dot com
@ 2015-07-06  1:13 ` hjl.tools at gmail dot com
  2015-07-06  1:25 ` [Bug libstdc++/66771] " hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-07-06  1:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
[hjl@gnu-ivb-1 build_base_lnx32e-gcc.0000]$ cat foo.cc
#include <iostream>

char buf[300];
bool readLine(std::istream& m_input)
{
  if (m_input.getline(buf, sizeof(buf)) == 0)
    return false;

  return true;
}
[hjl@gnu-ivb-1 build_base_lnx32e-gcc.0000]$ g++ -O2 -c foo.cc
[hjl@gnu-ivb-1 build_base_lnx32e-gcc.0000]$ g++ -O2 -c foo.cc -std=c++11
foo.cc: In function \u2018bool readLine(std::istream&)\u2019:
foo.cc:6:41: error: no match for \u2018operator==\u2019 (operand types are
\u2018std::basic_istream<char>::__istream_type {aka
std::basic_istream<char>}\u2019 and \u2018int\u2019)
   if (m_input.getline(buf, sizeof(buf)) == 0)
                                         ^
foo.cc:6:41: note: candidate: operator==(int, int) <built-in>
foo.cc:6:41: note:   no known conversion for argument 1 from
\u2018std::basic_istream<char>::__istream_type {aka
std::basic_istream<char>}\u2019 to \u2018int\u2019
In file included from /usr/include/c++/5.1.1/bits/locale_facets.h:48:0,
                 from /usr/include/c++/5.1.1/bits/basic_ios.h:37,
                 from /usr/include/c++/5.1.1/ios:44,
                 from /usr/include/c++/5.1.1/ostream:38,
                 from /usr/include/c++/5.1.1/iostream:39,
                 from foo.cc:1:
/usr/include/c++/5.1.1/bits/streambuf_iterator.h:204:5: note: candidate:
template<class _CharT, class _Traits> bool std::operator==(const
std::istreambuf_iterator<_CharT, _Traits>&, const
std::istreambuf_iterator<_CharT, _Traits>&)
     operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
     ^
/usr/include/c++/5.1.1/bits/streambuf_iterator.h:204:5: note:   template
argument deduction/substitution failed:
...


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/66771] [5/6 Regression] -std=c++11 doesn't work
  2015-07-05 20:39 [Bug c++/66771] New: [5 Regression] -std=c++11 doesn't work hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2015-07-06  1:13 ` hjl.tools at gmail dot com
@ 2015-07-06  1:25 ` hjl.tools at gmail dot com
  2015-07-06  7:01 ` rguenth at gcc dot gnu.org
  2015-07-06  8:09 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2015-07-06  1:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Clang 3.7:

/export/build/gnu/llvm-clang-x32-bootstrap-cmake/stage1/build-x86_64-linux-gnux32/bin/clang
-c -O2 foo.cc
gnu-ivb-1:pts/1[124]>
/export/build/gnu/llvm-clang-x32-bootstrap-cmake/stage1/build-x86_64-linux-gnux32/bin/clang
-c -O2 foo.cc -std=c++11
foo.cc:6:41: error: invalid operands to binary expression ('__istream_type'
(aka
      'basic_istream<char, std::char_traits<char> >') and 'int')
  if (m_input.getline(buf, sizeof(buf)) == 0)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
1 error generated.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/66771] [5/6 Regression] -std=c++11 doesn't work
  2015-07-05 20:39 [Bug c++/66771] New: [5 Regression] -std=c++11 doesn't work hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2015-07-06  1:25 ` [Bug libstdc++/66771] " hjl.tools at gmail dot com
@ 2015-07-06  7:01 ` rguenth at gcc dot gnu.org
  2015-07-06  8:09 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-06  7:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think those are simply invalid uses of C++ (I've seen such instances in a few
packages).


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/66771] [5/6 Regression] -std=c++11 doesn't work
  2015-07-05 20:39 [Bug c++/66771] New: [5 Regression] -std=c++11 doesn't work hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2015-07-06  7:01 ` rguenth at gcc dot gnu.org
@ 2015-07-06  8:09 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2015-07-06  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #3)
>   if (m_input.getline(buf, sizeof(buf)) == 0)
>     return false;

This is not valid in C++11, and was poor style even in C++03.

The portable way to write it is:

  if (m_input.getline(buf, sizeof(buf)))
    return false;


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-07-06  8:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-05 20:39 [Bug c++/66771] New: [5 Regression] -std=c++11 doesn't work hjl.tools at gmail dot com
2015-07-05 20:59 ` [Bug c++/66771] [5/6 " hjl.tools at gmail dot com
2015-07-06  0:55 ` hjl.tools at gmail dot com
2015-07-06  1:13 ` hjl.tools at gmail dot com
2015-07-06  1:25 ` [Bug libstdc++/66771] " hjl.tools at gmail dot com
2015-07-06  7:01 ` rguenth at gcc dot gnu.org
2015-07-06  8:09 ` redi at gcc dot gnu.org

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