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 12:08:00 -0000	[thread overview]
Message-ID: <bug-67398-4-vkKqvGrYER@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 #5 from Mikhail Maltsev <miyuki at gcc dot gnu.org> ---
$ cat test3.cc 
template <typename>
struct B {
    static const int staticMetaObject;
};

template <typename T>
struct D {
    int stringdata0 = T::className;
} staticStringData{};

template <typename T>
const int B<T>::staticMetaObject{staticStringData<T>};

void foo()
{
    B<int> constraints;
    constraints.staticMetaObject;
}

$ cc1plus test3.cc                                                              
test3.cc: In instantiation of 'D staticStringData<int>':
test3.cc:12:50:   required from 'const int B<int>::staticMetaObject'
test3.cc:17:17:   required from here
test3.cc:9:3: internal compiler error: Segmentation fault
 } staticStringData{};
   ^
0xc847bf crash_signal
        /home/miyuki/gcc/src/gcc/toplev.c:352
0x5e36b3 extend_ref_init_temps(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**)
        /home/miyuki/gcc/src/gcc/cp/call.c:9892
0x5e3724 extend_ref_init_temps(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**)
        /home/miyuki/gcc/src/gcc/cp/call.c:9914
0x6868d9 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        /home/miyuki/gcc/src/gcc/cp/typeck2.c:806
0x5ef6ae check_initializer
        /home/miyuki/gcc/src/gcc/cp/decl.c:6089


$ clang++ -std=c++14 -S test3.cc 
test3.cc:9:2: error: expected ';' after struct
} staticStringData{};
 ^
 ;
test3.cc:9:3: error: C++ requires a type specifier for all declarations
} staticStringData{};


  parent reply	other threads:[~2015-08-30 12:08 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 [this message]
2015-08-30 14:32 ` miyuki at gcc dot gnu.org

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-vkKqvGrYER@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: link
Be 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).