[Bug c++/51141] New: [4.7 regression] rev181359 causes Chromium build failure

markus at trippelsdorf dot de gcc-bugzilla@gcc.gnu.org
Tue Nov 15 14:10:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51141

             Bug #: 51141
           Summary: [4.7 regression] rev181359 causes Chromium build
                    failure
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: markus@trippelsdorf.de


Please consider:

 % cat test.ii
typedef int size_t;
template < size_t, size_t > struct AlignedBuffer;
template < size_t size > struct AlignedBuffer 
         < size, 8 > {
};

template < typename > class VectorBufferBase
{
public:
    allocateBuffer (size_t) {
    }
    buffer () {
    }
    *m_buffer;
    size_t m_capacity;
};

template < typename T, size_t > class VectorBuffer:VectorBufferBase < T >
{
    typedef VectorBufferBase < T > Base;

public:
    VectorBuffer () {
    }
    allocateBuffer (size_t) {
        m_capacity = 0;
    }
    Base::buffer;
    Base::m_buffer;
    Base::m_capacity;
    size_t m_inlineBufferSize;

    AlignedBuffer < 0, __alignof__ (T) > m_inlineBuffer;
};

template < typename T, size_t > class Vector
{
    typedef VectorBuffer < T,
            0 > Buffer;
public:
    void shrinkCapacity (size_t);

    clear () {
        shrinkCapacity (0);
    }
    Buffer m_buffer;
};

template < typename T, size_t inlineCapacity > void Vector < T,
         inlineCapacity >::shrinkCapacity (size_t)
{
    m_buffer.allocateBuffer (0);
}

struct PatternDisjunction;
struct YarrPattern {
    reset () {
        m_disjunctions.clear ();
    }
    Vector < PatternDisjunction *, 0 > m_disjunctions;
};

 % g++ -S -fpermissive -w -Werror -O0 -pipe -c test.ii -o /dev/null
test.ii: In instantiation of ‘int VectorBuffer<T, <anonymous>
>::allocateBuffer(size_t) [with T = PatternDisjunction*; int <anonymous> = 0;
size_t = int]’:
test.ii:52:5:   required from ‘void Vector<T, <anonymous>
>::shrinkCapacity(size_t) [with T = PatternDisjunction*; int <anonymous> = 0;
size_t = int]’
test.ii:44:9:   required from ‘int Vector<T, <anonymous> >::clear() [with T =
PatternDisjunction*; int <anonymous> = 0]’
test.ii:58:31:   required from here
test.ii:26:9: error: no match for ‘operator=’ in ‘#‘using_decl’ not supported
by dump_expr#<expression error> = 0’
test.ii:26:9: note: candidate is:
test.ii:7:29: note: VectorBufferBase<PatternDisjunction*>&
VectorBufferBase<PatternDisjunction*>::operator=(const
VectorBufferBase<PatternDisjunction*>&)
test.ii:7:29: note:   no known conversion for argument 1 from ‘int’ to ‘const
VectorBufferBase<PatternDisjunction*>&’


This happens because of:
commit 807f85cfb63c455ad591e9786293e05fe725b9ab
Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Nov 14 17:55:57 2011 +0000

        PR c++/6936
        PR c++/25994
        PR c++/26256
        PR c++/30195
        * search.c (lookup_field_1): Look through USING_DECL.
        (lookup_field_r): Call lookup_fnfields_slot instead of
        lookup_fnfields_1.
        * semantics.c (finish_member_declaration): Remove the check that
        prevents USING_DECLs from being verified by
        pushdecl_class_level. Call add_method for using declarations that
        designates functions if the using declaration is in a template
        class. Set DECL_IGNORED_P on class-scope using declarations.
        * typeck.c (build_class_member_access_expr): Handle USING_DECLs.
        * class.c (check_field_decls): Keep using declarations.
        (add_method): Remove two diagnostics about conflicting using
        declarations.
        * parser.c (cp_parser_nonclass_name): Handle USING_DECLs.
        * decl.c (start_enum): Call xref_tag whenever possible.
        * cp-tree.h (strip_using_decl): Declare, and reident the previous
        function.
        * name-lookup.c (strip_using_decl): New function.
        (supplement_binding_1): Call strip_using_decl on decl and
        bval. Perform most of the checks with USING_DECLs stripped.  Also
        check that the target decl and the target bval does not refer to
        the same declaration. Allow pushing an enum multiple times in a
        template class. Adjustment to diagnose using redeclarations. Call
        diagnose_name_conflict.
        (push_class_level_binding): Call strip_using_decl on decl and
        bval. Perform most of the checks with USING_DECLs stripped. Return
        true if both decl and bval refer to USING_DECLs and are dependent.
        (diagnose_name_conflict): New function.

    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181359
138bc75d-0d04-0410-961f-82ee72b054a4



More information about the Gcc-bugs mailing list