public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61362] g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2 does not compile lambda with template
Date: Fri, 30 May 2014 15:14:00 -0000	[thread overview]
Message-ID: <bug-61362-4-yaI9UKRZrc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61362-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
Reduced example (removing library dependencies) using compiler flags

 -Wall -Wextra -std=c++11 -pedantic 

for gcc HEAD 4.10.0 20140529 (experimental)

//---------------------
struct function {
  template<class F>
  function(F){}

  void operator()(...) {}
};

struct Node {
  unsigned length;
};

template<typename N>
class C {
public:
  unsigned longest = 0;
  function f = [this](N node) {
    if(node->length > this->longest) this->longest = node->length;
  };
};

int main() {
  Node n;
  n.length = 5;
  C<Node*> c;
  c.f(&n);
}
//---------------------

results in

"prog.cc: In instantiation of 'C<N>::<lambda(N)> [with N = Node*]':
prog.cc:16:17: required from 'struct C<Node*>::<lambda(struct Node*)>'
prog.cc:24:12: required from here prog.cc:16:29: internal compiler error:
Segmentation fault function f = [this](N node) { ^ 0x96976f crash_signal
/home/heads/gcc/gcc-source/gcc/toplev.c:337 0x56ddb5
instantiate_decl(tree_node*, int, bool)
/home/heads/gcc/gcc-source/gcc/cp/pt.c:19932 0x5802b1
instantiate_class_template_1 /home/heads/gcc/gcc-source/gcc/cp/pt.c:9367
0x5802b1 instantiate_class_template(tree_node*)
/home/heads/gcc/gcc-source/gcc/cp/pt.c:9435 0x5d726d complete_type(tree_node*)
/home/heads/gcc/gcc-source/gcc/cp/typeck.c:134 0x567644
tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
/home/heads/gcc/gcc-source/gcc/cp/pt.c:15327 0x5ec715 get_nsdmi(tree_node*,
bool) /home/heads/gcc/gcc-source/gcc/cp/init.c:543 0x5f4bf4 walk_field_subobs
/home/heads/gcc/gcc-source/gcc/cp/method.c:1098 0x5f53bc
synthesized_method_walk /home/heads/gcc/gcc-source/gcc/cp/method.c:1424
0x5f64b5 get_defaulted_eh_spec(tree_node*)
/home/heads/gcc/gcc-source/gcc/cp/method.c:1455 0x581707
maybe_instantiate_noexcept(tree_node*)
/home/heads/gcc/gcc-source/gcc/cp/pt.c:19563 0x599ae7 mark_used(tree_node*,
int) /home/heads/gcc/gcc-source/gcc/cp/decl2.c:4823 0x537459 build_over_call
/home/heads/gcc/gcc-source/gcc/cp/call.c:7325 0x53de3a build_new_method_call_1
/home/heads/gcc/gcc-source/gcc/cp/call.c:8037 0x53de3a
build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
/home/heads/gcc/gcc-source/gcc/cp/call.c:8107 0x53e6e6
build_special_member_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, int)
/home/heads/gcc/gcc-source/gcc/cp/call.c:7651 0x5ef036 expand_default_init
/home/heads/gcc/gcc-source/gcc/cp/init.c:1713 0x5ef036 expand_aggr_init_1
/home/heads/gcc/gcc-source/gcc/cp/init.c:1814 0x5f096e
build_aggr_init(tree_node*, tree_node*, int, int)
/home/heads/gcc/gcc-source/gcc/cp/init.c:1566 0x549a2d
build_aggr_init_full_exprs /home/heads/gcc/gcc-source/gcc/cp/decl.c:5642 Please
submit a full bug report, with preprocessed source if appropriate. Please
include the complete backtrace with any bug report. See
<http://gcc.gnu.org/bugs.html> for instructions."
>From gcc-bugs-return-452868-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri May 30 15:39:58 2014
Return-Path: <gcc-bugs-return-452868-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 22599 invoked by alias); 30 May 2014 15:39:58 -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 22558 invoked by uid 48); 30 May 2014 15:39:54 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/36183] misleading error message with explicit copy constructor call
Date: Fri, 30 May 2014 15:39:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.2.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
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 cc everconfirmed bug_severity
Message-ID: <bug-36183-4-YGArSAezWA@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-36183-4@http.gcc.gnu.org/bugzilla/>
References: <bug-36183-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-05/txt/msg02560.txt.bz2
Content-length: 1214

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-05-30
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |manu at gcc dot gnu.org
     Ever confirmed|0                           |1
           Severity|trivial                     |normal

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
It seems to me that the problem is the "explicit" keyword, so an error like:

test.cc:14:6: error: no matching function for call to ‘B::B(const B&)’
   f(b); // error: no matching function for call to 'B::B(const B&)'
      ^
test.cc:4:3: note: candidate: 'explicit B::B(const B&)'
   B() {}
   ^
test.cc:4:3: note:   is marked as explicit but implicit conversion required
test.cc:8:6: note:   initializing argument 1 of ‘void f(B)’
 void f(B obj) {}
      ^

Jason?
>From gcc-bugs-return-452869-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri May 30 15:46:01 2014
Return-Path: <gcc-bugs-return-452869-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27085 invoked by alias); 30 May 2014 15:46:01 -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 27039 invoked by uid 48); 30 May 2014 15:45:58 -0000
From: "crrodriguez at opensuse dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/61371] New: cpp: Implement -fno-date-time/-freproducible-dates or similar
Date: Fri, 30 May 2014 15:46:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: preprocessor
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: crrodriguez at opensuse dot org
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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-61371-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-05/txt/msg02561.txt.bz2
Content-length: 1336

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

            Bug ID: 61371
           Summary: cpp: Implement -fno-date-time/-freproducible-dates or
                    similar
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crrodriguez at opensuse dot org

Hi:

Current releases have the option to warn/err on the use of __DATE__ , __TIME__
and __TIMESTAMP__, first thanks for implementing this as it is a good step to
aid reproducible builds. That said, it is unfortunately still quite
inconvenient for large scale projects such as distributions because it requires
going through hundreds or thousands of packages.

I suggest a command line option to be implemented such as

-fno-date-time
-freproducible-dates

Or whatever other appropriate name that behaves in one of this ways:

Either:

- __DATE__, __TIME__ and __TIMESTAMP__ expand as  "If GCC cannot determine the
current date" (that is ???...)

- __DATE__ and __TIME__ expand to the file 's  last modification time

- Whatever other sane alternative that ensures different builds of the same
source code and same preprocessor/compiler/linker options result in identical
builds.


  parent reply	other threads:[~2014-05-30 15:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29 22:00 [Bug c++/61362] New: " dgront at chem dot uw.edu.pl
2014-05-29 22:01 ` [Bug c++/61362] " dgront at chem dot uw.edu.pl
2014-05-30 15:07 ` daniel.kruegler at googlemail dot com
2014-05-30 15:14 ` daniel.kruegler at googlemail dot com [this message]
2014-06-26 17:10 ` paolo.carlini at oracle dot com
2015-03-07 10:46 ` thibaut.lutz at googlemail dot com
2015-10-11 19:32 ` ville.voutilainen at gmail dot com
2015-10-11 19:41 ` ville.voutilainen at gmail dot com
2015-10-12 10:53 ` thibaut.lutz at googlemail 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-61362-4-yaI9UKRZrc@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).