public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "trashyankes at wp dot pl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/50785] [C++0x] static constexpr double undefined reference
Date: Wed, 19 Oct 2011 16:35:00 -0000	[thread overview]
Message-ID: <bug-50785-4-sJZprtriDw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-50785-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #11 from trashyankes at wp dot pl 2011-10-19 16:35:06 UTC ---
it will be possible to add better waring/error in this case?
is complicity misleading when you use `static const` or `static constexpr` for
long time and when you try get ref that value you get error.
its get very weird when you have two lines that use it and only one give error.
code:

struct test
{
    static const int z = 6;
    static constexpr double t = 0.001;
};
template<class T>
T ref(const T& i)
{
    return i;
}
template<class T>
T value(const T i)
{
    return i;
}

int main()
{
    value(test::z);
    value(test::t);
    ref(test::z); //error
    ref(test::t); //error
}

until today i thought this code is correct.
maybe some info when you try take ref from const static objects?


  parent reply	other threads:[~2011-10-19 16:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19  1:04 [Bug c++/50785] New: [C++0x][constexpr] " trashyankes at wp dot pl
2011-10-19  1:35 ` [Bug c++/50785] " paolo.carlini at oracle dot com
2011-10-19  8:35 ` redi at gcc dot gnu.org
2011-10-19 12:34 ` paolo.carlini at oracle dot com
2011-10-19 12:45 ` redi at gcc dot gnu.org
2011-10-19 12:46 ` redi at gcc dot gnu.org
2011-10-19 12:49 ` paolo.carlini at oracle dot com
2011-10-19 12:55 ` [Bug c++/50785] [C++0x] " daniel.kruegler at googlemail dot com
2011-10-19 12:58 ` [Bug c++/50785] [C++0x][constexpr] " paolo.carlini at oracle dot com
2011-10-19 13:04 ` [Bug c++/50785] [C++0x] " redi at gcc dot gnu.org
2011-10-19 13:09 ` daniel.kruegler at googlemail dot com
2011-10-19 16:35 ` trashyankes at wp dot pl [this message]
2011-10-19 16:58 ` redi at gcc dot gnu.org
2011-10-19 17:12 ` redi 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-50785-4-sJZprtriDw@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).