public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "drew.dormann at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/65919] New: Regression - GCC 5.1 with options "-g -std=c++14" fails to compile multiple lambdas used as default function parameters
Date: Tue, 28 Apr 2015 17:47:00 -0000	[thread overview]
Message-ID: <bug-65919-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 65919
           Summary: Regression - GCC 5.1 with options "-g -std=c++14"
                    fails to compile multiple lambdas used as default
                    function parameters
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drew.dormann at gmail dot com
  Target Milestone: ---

The following program compiles with GCC 4.9, but will not compile using GCC 5.1

Command:

    g++ -std=c++14 -g TEST.cpp

Source:

    #include <functional>

    struct TestClass
    {
        static void do_things( std::function<void()> first = []{},
                               std::function<void()> second = []{} );
    };

    int main()
    {
        TestClass::do_things();
    }

Output:

TEST.cpp:12:1: error: ‘static void
std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&,
_Functor&&, std::false_type) [with _Functor = TestClass::<lambda()>;
std::false_type = std::integral_constant<bool, false>]’ conflicts with a
previous declaration
 }
 ^
In file included from TEST.cpp:1:0:
/usr/include/c++/5/functional:1786:2: note: previous declaration ‘static void
std::_Function_base::_Base_manager<_Functor>::_M_init_functor(std::_Any_data&,
_Functor&&, std::false_type) [with _Functor = TestClass::<lambda()>;
std::false_type = std::integral_constant<bool, false>]’
  _M_init_functor(_Any_data& __functor, _Functor&& __f, false_type)
  ^
/usr/include/c++/5/functional:1786:2: note: a later -fabi-version= (or =0)
avoids this error with a change in mangling
TEST.cpp:12:1: error: ‘static void
std::_Function_base::_Base_manager<_Functor>::_M_destroy(std::_Any_data&,
std::false_type) [with _Functor = TestClass::<lambda()>; std::false_type =
std::integral_constant<bool, false>]’ conflicts with a previous declaration
 }
 ^
In file included from TEST.cpp:1:0:
/usr/include/c++/5/functional:1724:2: note: previous declaration ‘static void
std::_Function_base::_Base_manager<_Functor>::_M_destroy(std::_Any_data&,
std::false_type) [with _Functor = TestClass::<lambda()>; std::false_type =
std::integral_constant<bool, false>]’
  _M_destroy(_Any_data& __victim, false_type)
  ^
/usr/include/c++/5/functional:1724:2: note: a later -fabi-version= (or =0)
avoids this error with a change in mangling
TEST.cpp:12:1: error: ‘static void
std::_Function_base::_Base_manager<_Functor>::_M_clone(std::_Any_data&, const
std::_Any_data&, std::false_type) [with _Functor = TestClass::<lambda()>;
std::false_type = std::integral_constant<bool, false>]’ conflicts with a
previous declaration
 }
 ^
In file included from TEST.cpp:1:0:
/usr/include/c++/5/functional:1708:2: note: previous declaration ‘static void
std::_Function_base::_Base_manager<_Functor>::_M_clone(std::_Any_data&, const
std::_Any_data&, std::false_type) [with _Functor = TestClass::<lambda()>;
std::false_type = std::integral_constant<bool, false>]’
  _M_clone(_Any_data& __dest, const _Any_data& __source, false_type)
  ^
/usr/include/c++/5/functional:1708:2: note: a later -fabi-version= (or =0)
avoids this error with a change in mangling

Version:

g++ -v
Using built-in specs.
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) 

Observations:

The code will compile if any one of the following changes are made.

- Use g++-4.9
- Compile without the "-g" option
- Remove either parameter from "do_things" prototype
- Make "do_things" prototype a global function instead of a static member
funtion.
- Change the default parameters from a "do nothing" lambda to a "do nothing"
function name.
>From gcc-bugs-return-484888-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Apr 28 17:57:18 2015
Return-Path: <gcc-bugs-return-484888-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30019 invoked by alias); 28 Apr 2015 17:57:17 -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 29723 invoked by uid 48); 28 Apr 2015 17:57:14 -0000
From: "schwab@linux-m68k.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug web/64968] Upgrade GCC Bugzilla to 5.0
Date: Tue, 28 Apr 2015 17:57:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: web
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: schwab@linux-m68k.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: LpSolit at netscape dot net
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64968-4-ToLb9kQgaZ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64968-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64968-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/msg02440.txt.bz2
Content-length: 530

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

--- Comment #20 from Andreas Schwab <schwab@linux-m68k.org> ---
I don't think this has anything to do with the timezone of the commenter.  For
example the mail for comment #19 has the date "Tue, 28 Apr 2015 16:28:19 +0000"
(which is correct), but comment #18 was sent with the date "Tue, 28 Apr 2015
10:44:58 +0000" (which is 5:30(!) hours off).  Both mails were sent immediately
after the comment was entered, and I assume that both were entered from the
same local timezone.


             reply	other threads:[~2015-04-28 17:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28 17:47 drew.dormann at gmail dot com [this message]
2015-04-28 19:51 ` [Bug c++/65919] " maltsevm at gmail dot com
2015-06-24  9:33 ` paolo.carlini at oracle dot com
2015-06-24  9:35 ` [Bug c++/65919] [5/6 Regression] " paolo.carlini at oracle dot com
2015-06-24 20:25 ` jason 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-65919-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).