public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "miyuki at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/67398] Segfault when template static references another template Date: Sun, 30 Aug 2015 14:32:00 -0000 [thread overview] Message-ID: <bug-67398-4-3DvaGC5g6x@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-67398-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67398 --- Comment #6 from Mikhail Maltsev <miyuki at gcc dot gnu.org> --- $ cat test4_min.cc struct B { void *extradata; }; template <typename> class C { static const B b; virtual void m_fn1() { (void)b; } }; template <typename> struct strdata_t { int data[]; }; template <typename T> const B C<T>::b{strdata_t<T>{}.data}; C<int> c; $ cc1plus test4_min.cc test4_min.cc: In function 'void __static_initialization_and_destruction_0(int, int)': test4_min.cc:17:9: internal compiler error: in make_decl_rtl, at varasm.c:1306 const B C<T>::b{strdata_t<T>{}.data}; ^ 0xf53495 make_decl_rtl(tree_node*) /home/miyuki/gcc/src/gcc/varasm.c:1302 0x9cfb79 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) /home/miyuki/gcc/src/gcc/expr.c:9525 0x9d9dc6 expand_expr /home/miyuki/gcc/src/gcc/expr.h:255 0x9d9dc6 expand_expr_addr_expr_1 /home/miyuki/gcc/src/gcc/expr.c:7600 Reproduced on trunk. BTW, Clang accepts it, but issues a warning (apparently, I overlooked that the error in my previous comment was caused by invalid constexpr initialization): test4_min.cc:17:17: warning: pointer is initialized by a temporary array, which will be destroyed at the end of the full-expression [-Waddress-of-array-temporary] const B C<T>::b{strdata_t<T>{}.data};
prev parent reply other threads:[~2015-08-30 14:32 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-08-30 7:23 [Bug c++/67398] New: " jeanmichael.celerier at gmail dot com 2015-08-30 7:31 ` [Bug c++/67398] " jeanmichael.celerier at gmail dot com 2015-08-30 9:30 ` trippels at gcc dot gnu.org 2015-08-30 11:38 ` miyuki at gcc dot gnu.org 2015-08-30 12:08 ` miyuki at gcc dot gnu.org 2015-08-30 14:32 ` miyuki at gcc dot gnu.org [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-67398-4-3DvaGC5g6x@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).