c++/8442: Wrongful compiler error - file available

Juan Carlos Arevalo-Baeza jcab@JCABs-Rumblings.com
Tue Nov 5 00:35:00 GMT 2002


On Mon, 4 Nov 2002 10:58:35 -0600 (CST), Wolfgang Bangerth wrote:
>
>>Yes, Spirit is a complex beast. I'm sorry about that. I've tried
>>extracting the error bits, but I've been uncuccessful so far. It seems
>
>Start from the .ii file you have. First delete all the # lines, I use the
>following perl script for that usually
>perl -pi -s 's/^#.*\n//g;' your_file.ii
>(This way, gcc tells you the real location in the file where something is
>happening, not the location in the file from which you generated the .ii
>file.) Then start deleting parts of the file that are not necessary to
>show the problem. (Function bodies, classes that are only referenced in
>the function bodies you deleted, classes and namespaces that were only
>used in classes and namespaces you deleted, etc). In the beginning, the
>pieces you scrap are usually small, but the blocks can become very large
>at the end, so don't be scared if you don't make much progress in the
>beginning.
>
>This is a tedious task, and may take an hour or two, but in the end you
>usually end up with something that has 10-50 lines of code and still shows
>the problem. With such an example, it is also possible for someone who is
>not used to your code to see whether this is wrong or right. Otherwise, it
>is very hard to see...

   Ok. I managed to do as you say (turned out step by step as you say <g>), and boiled it down to this code:

---
template < class FunctorT >
struct functor_parser {
};

template < typename ScannerT >
struct definition
{
    template < typename ParserT >
    struct brace_block_functor {
    };

    template < typename ParserT >
    static
    functor_parser<brace_block_functor<ParserT> >*
    brace_block(ParserT const& parser) { // line 15
        return 0;
    };
};

definition<char const*> def; // line 20
---

   Error spew:

---
bug.ii: In instantiation of `definition<const char*>':
bug.ii:20:   instantiated from here
bug.ii:15: type/value mismatch at argument 1 in template parameter list for `
   template<class FunctorT> struct functor_parser'
bug.ii:15:   expected a type, got `brace_block_functor'
bug.ii:15: confused by earlier errors, bailing out
---

   This is clearly wrong.

   Salutaciones,
                    JCAB
email: jcab@JCABs-Rumblings.com
ICQ: 10913692 @WORK: 101728263
WWW: http://www.JCABs-Rumblings.com



More information about the Gcc-bugs mailing list