public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54777] New: [C++11] Comma operator in constexpr environment can cause ICE
@ 2012-10-02  8:22 daniel.kruegler at googlemail dot com
  2012-10-02  9:08 ` [Bug c++/54777] " mpolacek at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-10-02  8:22 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54777
           Summary: [C++11] Comma operator in constexpr environment can
                    cause ICE
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com


Using gcc 4.8.0 20120923 (experimental) and compiler flags

-Wall -pedantic -std=c++11

the following code gives an ICE:

//-------------
struct array {
    int data[1];
    constexpr const int& at(unsigned i)
    {
      return (i < 1 ? 0 : throw 1), data[i];
      //return i < 1 ? data[i] : (throw 0, data[i]); // OK
    }
};

int main() {
  constexpr array a{};
  constexpr int i = a.at(0);
}
//-------------

"
main.cpp||In function 'int main()':|
main.cpp|12|  in constexpr expansion of 'a.array::at(0u)'|
main.cpp|12|internal compiler error: in adjust_temp_type, at
cp/semantics.c:6425|
"

The code should be accepted.


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

end of thread, other threads:[~2012-11-29 21:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-02  8:22 [Bug c++/54777] New: [C++11] Comma operator in constexpr environment can cause ICE daniel.kruegler at googlemail dot com
2012-10-02  9:08 ` [Bug c++/54777] " mpolacek at gcc dot gnu.org
2012-10-02 10:18 ` jakub at gcc dot gnu.org
2012-10-02 10:19 ` jakub at gcc dot gnu.org
2012-10-03 14:21 ` jakub at gcc dot gnu.org
2012-10-03 14:27 ` jakub at gcc dot gnu.org
2012-10-03 14:32 ` jakub at gcc dot gnu.org
2012-11-29 21:28 ` paolo.carlini at oracle 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).