public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "f.heckenbach@fh-soft.de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57941] New: [c++11] confusing error message with invalid constexpr constructor in template struct
Date: Sat, 20 Jul 2013 17:41:00 -0000	[thread overview]
Message-ID: <bug-57941-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57941

            Bug ID: 57941
           Summary: [c++11] confusing error message with invalid constexpr
                    constructor in template struct
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.heckenbach@fh-soft.de

% cat test.cpp
template <typename T> struct a
{
  int i;
  constexpr a (): i (b ()) { }
  constexpr int b () { return c (); }
  int c () const { throw 42; }
  constexpr operator bool () { return true; }
};

static_assert (a <int> (), "foo");
%g++-4.7 -std=c++11 test.cpp 
test.cpp:10:1: error: non-constant condition for static assertion
test.cpp:10:1: error: 'constexpr a<T>::a() [with T = int]' called in a constant
expression
test.cpp:4:13: note: 'constexpr a<T>::a() [with T = int]' is not usable as a
constexpr function because:
%

Because what?

This message is particularly confusing if other unrelated messages appear
afterwards, as it wrongly claims those to be the reason for this one.

(I understand that the program is wrong, it's just about the message.)


             reply	other threads:[~2013-07-20 17:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-20 17:41 f.heckenbach@fh-soft.de [this message]
2013-07-20 20:54 ` [Bug c++/57941] " manu at gcc dot gnu.org
2014-11-03 10:31 ` paolo.carlini at oracle dot com
2014-11-18  3:44 ` 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-57941-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).