public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/65928] New: std::find_if compilation errors
@ 2015-04-29 10:19 david.claessens at tomra dot com
  2015-04-29 11:16 ` [Bug libstdc++/65928] " glisse at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: david.claessens at tomra dot com @ 2015-04-29 10:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65928
           Summary: std::find_if compilation errors
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.claessens at tomra dot com
  Target Milestone: ---

Created attachment 35421
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35421&action=edit
preprocessed file

COLLECT_GCC=g++-5
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
5.1.0-0ubuntu11~14.04.1' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-5 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=c++98 --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.1.0 (Ubuntu 5.1.0-0ubuntu11~14.04.1)


The code below compiles fine under 4.9.2 but gives errors under 5.1.0

compiler command: g++-5 -std=c++1y bug.cpp

adding -Wall -Wextra does not change the output for v5.1.0 but gives
unused-but-set-variable warnings on v4.9.2


#include <string>
#include <cctype>
#include <algorithm>

int main(int, char **)
{
    const std::string test_string("this is a test");

    auto first_space = std::find_if(
            std::begin(test_string),
            std::end(test_string),
            std::isblank);

    int (*myblank)(int) = &std::isblank;

    auto _space = std::find_if(
            std::begin(test_string),
            std::end(test_string),
            myblank);

    return 0;
}

The compiler output:
bug.cpp: In function ‘int main(int, char**)’:
bug.cpp:13:25: error: no matching function for call to
‘find_if(std::basic_string<char>::const_iterator,
std::basic_string<char>::const_iterator, <unresolved overloaded function
type>)’
             std::isblank);
                         ^
In file included from /usr/include/c++/5/algorithm:62:0,
                 from bug.cpp:4:
/usr/include/c++/5/bits/stl_algo.h:3806:5: note: candidate: template<class
_IIter, class _Predicate> _IIter std::find_if(_IIter, _IIter, _Predicate)
     find_if(_InputIterator __first, _InputIterator __last,
     ^
/usr/include/c++/5/bits/stl_algo.h:3806:5: note:   template argument
deduction/substitution failed:
bug.cpp:13:25: note:   couldn't deduce template parameter ‘_Predicate’
             std::isblank);
>From gcc-bugs-return-484953-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Apr 29 10:49:50 2015
Return-Path: <gcc-bugs-return-484953-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 105906 invoked by alias); 29 Apr 2015 10:49:50 -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 105866 invoked by uid 48); 29 Apr 2015 10:49:46 -0000
From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/65476] Long_Float array does not byte-swap correctly with reverse Scalar_Storage_Order
Date: Wed, 29 Apr 2015 10:49:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ada
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ebotcazou at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
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: bug_status cf_reconfirmed_on short_desc everconfirmed
Message-ID: <bug-65476-4-xAfylmmqxV@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65476-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65476-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: 2015-04/txt/msg02505.txt.bz2
Content-length: 761

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-04-29
            Summary|Long_Float array does not   |Long_Float array does not
                   |byte swap correctly when    |byte-swap correctly with
                   |set to Scalar_Storage_Order |reverse
                   |with High Order First       |Scalar_Storage_Order
     Ever confirmed|0                           |1

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Confirmed.


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

* [Bug libstdc++/65928] std::find_if compilation errors
  2015-04-29 10:19 [Bug libstdc++/65928] New: std::find_if compilation errors david.claessens at tomra dot com
@ 2015-04-29 11:16 ` glisse at gcc dot gnu.org
  2015-04-29 12:22 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: glisse at gcc dot gnu.org @ 2015-04-29 11:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
It seems normal to me. There are now several functions called isblank in
namespace std, and the compiler doesn't know which one to pick when you don't
give it a hint (like you do for myblank). A more explicit diagnostic would be
nice though.


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

* [Bug libstdc++/65928] std::find_if compilation errors
  2015-04-29 10:19 [Bug libstdc++/65928] New: std::find_if compilation errors david.claessens at tomra dot com
  2015-04-29 11:16 ` [Bug libstdc++/65928] " glisse at gcc dot gnu.org
@ 2015-04-29 12:22 ` redi at gcc dot gnu.org
  2015-04-29 12:56 ` david.claessens at tomra dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-29 12:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Definitely not a libstdc++ bug, the code is simply not valid C++ because
std::isblank is an overloaded function.


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

* [Bug libstdc++/65928] std::find_if compilation errors
  2015-04-29 10:19 [Bug libstdc++/65928] New: std::find_if compilation errors david.claessens at tomra dot com
  2015-04-29 11:16 ` [Bug libstdc++/65928] " glisse at gcc dot gnu.org
  2015-04-29 12:22 ` redi at gcc dot gnu.org
@ 2015-04-29 12:56 ` david.claessens at tomra dot com
  2015-04-29 13:00 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: david.claessens at tomra dot com @ 2015-04-29 12:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from david.claessens at tomra dot com ---
To be honest, I would have expected that since only <cctype> is included and
not <locale> where the other version of isblank is defined, there would be no
confusion.


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

* [Bug libstdc++/65928] std::find_if compilation errors
  2015-04-29 10:19 [Bug libstdc++/65928] New: std::find_if compilation errors david.claessens at tomra dot com
                   ` (2 preceding siblings ...)
  2015-04-29 12:56 ` david.claessens at tomra dot com
@ 2015-04-29 13:00 ` redi at gcc dot gnu.org
  2015-04-29 13:06 ` redi at gcc dot gnu.org
  2015-04-29 13:36 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-29 13:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It's unspecified whether any of your headers includes <locale>, and in our
implementation <string> includes it.


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

* [Bug libstdc++/65928] std::find_if compilation errors
  2015-04-29 10:19 [Bug libstdc++/65928] New: std::find_if compilation errors david.claessens at tomra dot com
                   ` (3 preceding siblings ...)
  2015-04-29 13:00 ` redi at gcc dot gnu.org
@ 2015-04-29 13:06 ` redi at gcc dot gnu.org
  2015-04-29 13:36 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-29 13:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
More precisely, <string> includes <bits/localefwd.h> which declares (but does
not define) the overload of std::isblank.


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

* [Bug libstdc++/65928] std::find_if compilation errors
  2015-04-29 10:19 [Bug libstdc++/65928] New: std::find_if compilation errors david.claessens at tomra dot com
                   ` (4 preceding siblings ...)
  2015-04-29 13:06 ` redi at gcc dot gnu.org
@ 2015-04-29 13:36 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-29 13:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The code is invalid. No amount of fiddling about with headers will change that.
Even if you manage to find some combination that works today, it might not work
tomorrow or with a different compiler. Fix the code.


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

end of thread, other threads:[~2015-04-29 13:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-29 10:19 [Bug libstdc++/65928] New: std::find_if compilation errors david.claessens at tomra dot com
2015-04-29 11:16 ` [Bug libstdc++/65928] " glisse at gcc dot gnu.org
2015-04-29 12:22 ` redi at gcc dot gnu.org
2015-04-29 12:56 ` david.claessens at tomra dot com
2015-04-29 13:00 ` redi at gcc dot gnu.org
2015-04-29 13:06 ` redi at gcc dot gnu.org
2015-04-29 13:36 ` 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).