public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51253] New: [C++11][DR 1030] Evaluation order (sequenced-before relation) among intializer-clauses in braced-init-list
@ 2011-11-21  4:24 ai.azuma at gmail dot com
  2012-10-10  9:24 ` [Bug c++/51253] [C++11][DR 1030] Evaluation order (sequenced-before relation) among initializer-clauses " paolo.carlini at oracle dot com
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: ai.azuma at gmail dot com @ 2011-11-21  4:24 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51253
           Summary: [C++11][DR 1030] Evaluation order (sequenced-before
                    relation) among intializer-clauses in braced-init-list
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ai.azuma@gmail.com


Since DR 1030 http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1030
was accepted, I expect that the following code is well-defined and exits with
the status code 0. However, GCC 4.7.0 20111112 (experimental) with -std=c++11
produces a wrong executable. In addition, it spuriously warns about undefined
operations with -Wsequence-point option.

//////////////////////////////////
struct swallow{
  template<typename... Types>
  swallow(Types &&...){}
};

template<int... IS>
int f()
{
  int i = 2;
  swallow{ i = i * IS + IS... };
  return i;
}

int main()
{
  // `i = i * 2 + 2' should be sequenced before `i = i * 3 + 3'
  return f<2, 3>() == 21 ? 0 : 1;
}
//////////////////////////////////


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2014-08-06 18:36 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-21  4:24 [Bug c++/51253] New: [C++11][DR 1030] Evaluation order (sequenced-before relation) among intializer-clauses in braced-init-list ai.azuma at gmail dot com
2012-10-10  9:24 ` [Bug c++/51253] [C++11][DR 1030] Evaluation order (sequenced-before relation) among initializer-clauses " paolo.carlini at oracle dot com
2013-07-05 13:49 ` akim.demaille at gmail dot com
2013-07-05 15:06 ` paolo.carlini at oracle dot com
2013-08-13 17:07 ` broes.decat at gmail dot com
2013-10-23 16:38 ` st at quanttec dot com
2013-11-25 11:54 ` akim.demaille at gmail dot com
2014-01-18 16:12 ` akim.demaille at gmail dot com
2014-03-06 14:38 ` akim.demaille at gmail dot com
2014-03-13 17:07 ` paolo.carlini at oracle dot com
2014-03-13 17:40 ` manu at gcc dot gnu.org
2014-04-10  8:14 ` akim.demaille at gmail dot com
2014-04-11 17:09 ` jason at gcc dot gnu.org
2014-06-03  9:29 ` redi at gcc dot gnu.org
2014-06-04  1:11 ` redi at gcc dot gnu.org
2014-06-04  6:23 ` akim.demaille at gmail dot com
2014-06-04 15:51 ` jason at gcc dot gnu.org
2014-06-30 14:26 ` jason at gcc dot gnu.org
2014-07-01  8:20 ` christophe.lyon at st dot com
2014-07-03  2:11 ` jason at gcc dot gnu.org
2014-07-07 11:57 ` christophe.lyon at st dot com
2014-08-01 18:53 ` jason at gcc dot gnu.org
2014-08-06 18:36 ` dacamara.cameron at gmail dot com

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).