Conversation started Jan 20, 2013 at 15:53.
Jan 20, 2013 15:53
#include <limits>

int main() {
    int const& x = std::numeric_limits<int>::digits;
}
VS, Code::Blocks, Eclipse, and Netbeans do all of that. Sublime Text 2 cannot (unless you hardcode what you want, which means you have to do it per project, which is a waste).
Why can I take a reference here?
@KonradRudolph because temps bind to const refs?
and constexpr definitely do so?
@rubenvb Hm, damn, inadequate example. My point is that the variable is defined, not only declared
at least I’m inferring this from a slightly more complex use case
that confuses me … why would it be defined?
And more to the point: is this required when specialising std::numeric_limits?
huh? It's constexpr. That means the definition needs to be known. A definition is a declaration.
Jan 20, 2013 15:57
@rubenvb No
I don't know what you're asking.
constexpr only needs an initialisation, not a definition
struct foo { static constexpr X = 10; }; // X is not defined.
@KonradRudolph C++03 18.2.1/3 For all members declared static const in the numeric_limits template, specializations shall define these values in such a way that they are usable as integral constant expressions.
Guys! Pancakes with apple sauce, so awesome!
Can only chat for like 10 seconds, must go back to kitchen :)
Okay, lemme update my example
Jan 20, 2013 15:59
@FredOverflow Potato pancakes…
@Potatoswatter As a matter of fact, I did put three potatoes in there! Are you a mind reader?
@FredOverflow Pancake awesome metric = |apples| * |potatoes|
elementary deduction
Blasted, why does the code work on Coliru but not locally?
lol
cause you need to use Clang to show you what's wrong.
@rubenvb coliru uses clang? I thought it used g++
Damn, the number of GCC problems I’ve stumbled across in the the last 24 hours is astounding
Jan 20, 2013 16:08
No, you need to use Clang instead of GCC to get a readable and to the point error message.
Clang 3.2 > GCC 4.7.2 when it comes to error messages.
@rubenvb How does that help me in this case? The problem is that two identical versions of GCC (assuming Coliru uses GCC 4.7.2) produce different behaviour
I.e. am I allowed to take the address here?
Who'd be up for Civ5 after I get back from drinking
'round midnight probably
@R.MartinhoFernandes @EtiennedeMartel
@KonradRudolph I get an undefined reference to std::numeric_limits<X<8ull> >::digits
GCC 4.7.2.
@rubenvb Yes, me too :/ And it ruins my day :(
More interesting still, remove the N template argument and substitute it by a integral constant in the digits initialisation, then you’ll get a compile error
@Zoidberg for wildly varying values of "work"
Jan 20, 2013 16:14
LiveWorkSpace also accepts it …
different code...?
huh, GCC 4.7.2 on LWS is also ok, Clang 3.2 has undefined reference.
@KonradRudolph Possibly, yes. Depends on the exact meaning of 'odr-use'.
GCC 4.6.3 is also fine.
Jan 20, 2013 16:15
nope, gcc 4.7.2 here gives undef reference
or wrong.
I believe Clang is correct, except that it should get TWO undefined references
@LucDanton Okay, but at least it should be consistent for X<8> and int, right?
@KonradRudolph As a matter of QoI. Conformance, no.
because it isn’t on my local GCC 4.7.2, and neither is it on LWS’ clang 3.2
@LucDanton Well. But conformance does depend on the meaning of odr-use, doesn’t it? And I thought C++11 had that clarified one way or another …
@KonradRudolph I don't recall. As I remember it there's always been a lot of leeway as to QoI.
 
Conversation ended Jan 20, 2013 at 16:20.