c++/5761: ICE #19990331 in grokdeclarator, using templates

jcab@JCABs-Rumblings.com jcab@JCABs-Rumblings.com
Sat Feb 23 14:30:00 GMT 2002


>Number:         5761
>Category:       c++
>Synopsis:       ICE #19990331 in grokdeclarator, using templates
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 23 12:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Juan Carlos Arevalo-Baeza
>Release:        3.0.3
>Organization:
>Environment:
CygWin
>Description:
The tiny program below ICEs the compiler. The culprit seems to be the "template" keyword in line 24, where it says "typedef super_t::template iterator<".
>How-To-Repeat:
Compile the following program:

---
template <  typename GrammarT >
struct grammar_filter {
    template < typename IteratorT >
    struct iterator
    {
        typedef typename GrammarT::result_type value_type;
    };
};

struct cpp_lexer_phase_1: grammar_filter<cpp_lexer_phase_1> {
    typedef char result_type;
};

template < typename Phase1 >
struct cpp_lexer_phase_2: grammar_filter<cpp_lexer_phase_2<Phase1> > {
    typedef cpp_lexer_phase_2<Phase1> this_t;
    typedef grammar_filter<cpp_lexer_phase_2<Phase1> > super_t;

    typedef char const* result_type;

    struct iterator: super_t::iterator<
                        typename Phase1::iterator<char const*>
                     > {
        typedef super_t::template iterator<
                        typename Phase1::iterator<char const*>
                     > super_iterator;
    };
};

cpp_lexer_phase_2<cpp_lexer_phase_1>::iterator::super_iterator* kk =
    reinterpret_cast<
        cpp_lexer_phase_2<cpp_lexer_phase_1>::super_t::iterator<
            cpp_lexer_phase_1::iterator<char const*>
        >*
    >
    (0);
---

I get:

---
$ g++ bug3.cpp -O2 -ftemplate-depth-50 -g
bug3.cpp:27: Internal error #19990331.
bug3.cpp:27: Internal compiler error in grokdeclarator, at cp/decl.c:9767
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
---
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list