Must template argument functions be treated as potentially constexpr?

Introduction template<int F(), int N = F()> void func (); In this answer we will go through the relevant sections of the International Standard, step by step, to prove that the above snippet is well-formed. What does the International Standard (N3337) say? The Standardese 14.1p9 Template parameters [temp.param] A default template-argument is a template-argument (14.3) … Read more

Is it legal to declare a constexpr initializer_list object?

Update: The situation got a bit more complicated after the resolution of CWG DR 1684 removed the requirement quoted below. Some more information can be found in this discussion on the std-discussion mailing list and in the related question Why isn’t `std::initializer_list` defined as a literal type? [decl.constexpr]/8: A constexpr specifier for a non-static member … Read more

How undefined are __builtin_ctz(0) or __builtin_clz(0)?

Unfortunately, even x86-64 implementations can differ – from Intel’s instruction set reference,BSF and BSR, with a source operand value of (0), leaves the destination undefined, and sets the ZF (zero flag). So the behaviour may not be consistent between micro-architectures or, say, AMD and Intel. (I believe AMD leaves the destination unmodified.) The newer LZCNT … Read more

Why doesn’t an if constexpr make this core constant expression error disappear?

The standard doesn’t say much about the discarded statement of an if constexpr. There are essentially two statements in [stmt.if] about these: In an enclosing template discarded statements are not instantiated. Names referenced from a discarded statement are not required ODR to be defined. Neither of these applies to your use: the compilers are correct … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)