Search Results

Search found 1 results on 1 pages for 'xryl669'.

Page 1/1 | 1 

  • Why is this undefined behaviour?

    - by xryl669
    Here's the sample code: X * makeX(int index) { return new X(index); } struct Tmp { mutable int count; Tmp() : count(0) {} const X ** getX() const { static const X* x[] = { makeX(count++), makeX(count++) }; return x; } }; This reports Undefined Behaviour on CLang version 500 in the static array construction. For sake of simplication for this post, the count is not static, but it does not change anything.

    Read the article

1