https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83988

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
           Priority|P3                          |P1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-01-23
                 CC|                            |dmalcolm at gcc dot gnu.org,
                   |                            |nathan at gcc dot gnu.org
            Summary|Internal compiler error in  |[8 Regression] Internal
                   |tsubst_baselink             |compiler error in
                   |                            |tsubst_baselink
     Ever confirmed|0                           |1

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Works with r255598.
ICEs with r255605.

Looks like r255605 may have introduced this.

Minimal reproducer:

$ cat ../../src/pr83988.C
template<class T> struct optional {};
struct get_from_json {
  template<typename GetWhat>
  explicit operator optional<GetWhat>() const {return optional<GetWhat> ();}
  template<typename AsWhat>
  optional<AsWhat> maybe() const
  {
    return this->operator optional<AsWhat>();
  }
};
void test()
{
  get_from_json().maybe<int>();
}


$ ./xg++ -B. ../../src/pr83988.C
../../src/pr83988.C: In instantiation of ‘optional<GetWhat>
get_from_json::maybe() const [with AsWhat = int]’:
../../src/pr83988.C:13:30:   required from here
../../src/pr83988.C:8:27: internal compiler error: in tsubst_baselink, at
cp/pt.c:14451
     return this->operator optional<AsWhat>();
            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
0x93759c tsubst_baselink
        ../../src/gcc/cp/pt.c:14451
0x9319ba tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.c:17996
0x92f82f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.c:17604
0x91d25c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.c:16779
0x91b435 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.c:15996
0x91a155 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.c:16263
0x918913 instantiate_decl(tree_node*, bool, bool)
        ../../src/gcc/cp/pt.c:23329
0x95ebdf instantiate_pending_templates(int)
        ../../src/gcc/cp/pt.c:23445
0x836612 c_parse_final_cleanups()
        ../../src/gcc/cp/decl2.c:4705
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to