public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65919] New: Regression - GCC 5.1 with options "-g -std=c++14" fails to compile multiple lambdas used as default function parameters
@ 2015-04-28 17:47 drew.dormann at gmail dot com
  2015-04-28 19:51 ` [Bug c++/65919] " maltsevm at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: drew.dormann at gmail dot com @ 2015-04-28 17:47 UTC (permalink / raw)
  To: gcc-bugs

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.


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

* [Bug c++/65919] Regression - GCC 5.1 with options "-g -std=c++14" fails to compile multiple lambdas used as default function parameters
  2015-04-28 17:47 [Bug c++/65919] New: Regression - GCC 5.1 with options "-g -std=c++14" fails to compile multiple lambdas used as default function parameters drew.dormann at gmail dot com
@ 2015-04-28 19:51 ` maltsevm at gmail dot com
  2015-06-24  9:33 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: maltsevm at gmail dot com @ 2015-04-28 19:51 UTC (permalink / raw)
  To: gcc-bugs

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

Mikhail Maltsev <maltsevm at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maltsevm at gmail dot com

--- Comment #1 from Mikhail Maltsev <maltsevm at gmail dot com> ---
Reduced testcase:

template <typename> class function;
template <typename> class _Base_manager {
public:
  void _M_manager();
  template <typename _Tp> static bool _M_not_empty_function(_Tp);
};

template <typename, typename> class A;
template <typename _Functor, typename... _ArgTypes>
class A<void(_ArgTypes...), _Functor> : public _Base_manager<_Functor> {};

template <typename _Res, typename... _ArgTypes>
class function<_Res(_ArgTypes...)> {
  template <typename, typename> using _Requires = int;

public:
  template <typename _Functor, typename = _Requires<_Functor, void>>
  function(_Functor);
};

template <typename _Res, typename... _ArgTypes>
template <typename _Functor, typename>
function<_Res(_ArgTypes...)>::function(_Functor p1) {
  A<_Res(), _Functor>::_M_not_empty_function(p1);
}

struct B {
  static void do_things(function<void()> = [] {}, function<void()> = [] {});
};

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


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

* [Bug c++/65919] Regression - GCC 5.1 with options "-g -std=c++14" fails to compile multiple lambdas used as default function parameters
  2015-04-28 17:47 [Bug c++/65919] New: Regression - GCC 5.1 with options "-g -std=c++14" fails to compile multiple lambdas used as default function parameters drew.dormann at gmail dot com
  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
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-06-24  9:33 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|drew.dormann at gmail dot com      |
           Severity|major                       |normal


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

* [Bug c++/65919] [5/6 Regression] GCC 5.1 with options "-g -std=c++14" fails to compile multiple lambdas used as default function parameters
  2015-04-28 17:47 [Bug c++/65919] New: Regression - GCC 5.1 with options "-g -std=c++14" fails to compile multiple lambdas used as default function parameters drew.dormann at gmail dot com
  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 ` paolo.carlini at oracle dot com
  2015-06-24 20:25 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-06-24  9:35 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-06-24
            Summary|Regression - GCC 5.1 with   |[5/6 Regression] GCC 5.1
                   |options "-g -std=c++14"     |with options "-g
                   |fails to compile multiple   |-std=c++14" fails to
                   |lambdas used as default     |compile multiple lambdas
                   |function parameters         |used as default function
                   |                            |parameters
     Ever confirmed|0                           |1


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

* [Bug c++/65919] [5/6 Regression] GCC 5.1 with options "-g -std=c++14" fails to compile multiple lambdas used as default function parameters
  2015-04-28 17:47 [Bug c++/65919] New: Regression - GCC 5.1 with options "-g -std=c++14" fails to compile multiple lambdas used as default function parameters drew.dormann at gmail dot com
                   ` (2 preceding siblings ...)
  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
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2015-06-24 20:25 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
   Target Milestone|---                         |5.2

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed on the trunk by one of the patches for bug 44282; I've backported the
relevant section.


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

end of thread, other threads:[~2015-06-24 20:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-28 17:47 [Bug c++/65919] New: Regression - GCC 5.1 with options "-g -std=c++14" fails to compile multiple lambdas used as default function parameters drew.dormann at gmail dot com
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

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