• uniform initialization of temporary reference

    From MJanes@21:1/5 to All on Tue May 17 06:29:10 2016
    { edited by mod to shorten lines to ~70 characters. -mod }

    consider the following code

    int x;
    using intref = int&;
    intref w{x}; // A
    intref{x}; // B

    now, line A compiles correctly both in clang and gcc ( it didn't as of
    c++11, defect fixed in c++14 AFAIK )

    the problem is line B: clang treats it the way one would expect
    ( a temporary reference is bound to x ) whereas gcc 4.9 treat it in
    the old defected way ( a temporary of type int is created and bound to
    the reference, resulting in a compiler error ).

    Who's right here ? thank you

    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)