Bug 620095 - Code does not compile with gcc 4.5
Code does not compile with gcc 4.5
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 631089
  Show dependency treegraph
 
Reported: 2010-07-31 17:03 EDT by Braden McDaniel
Modified: 2010-09-10 23:36 EDT (History)
3 users (show)

See Also:
Fixed In Version: gcc-4.5.1-3.fc14
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-09-10 23:36:02 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
koji build log from rawhide (296.88 KB, text/plain)
2010-07-31 17:03 EDT, Braden McDaniel
no flags Details
Preprocessed source (312.74 KB, application/x-xz)
2010-09-06 00:45 EDT, Braden McDaniel
no flags Details

  None (edit)
Description Braden McDaniel 2010-07-31 17:03:01 EDT
Created attachment 435800 [details]
koji build log from rawhide

Description of problem:
openvrml includes some code using boost::spirit that looks like this:

    template <typename Actions = null_x3d_vrml_parse_actions,
              typename ErrorHandler = x3d_vrml_parse_error_handler>
    struct x3d_vrml_grammar :
        boost::spirit::classic::grammar<x3d_vrml_grammar<Actions, ErrorHandler> > {

        template <typename ScannerT>
        struct definition :
            vrml97_grammar<Actions, ErrorHandler>::
            template definition<ScannerT> {
            ...
            static const boost::spirit::classic::functor_parser<
                typename base_t::template mftype_parser<
                    boost::spirit::classic::functor_parser<openvrml::bool_parser> > >
                mfbool_p;
            ...
        };
        ...
    };

    template <typename Actions, typename ErrorHandler>
    template <typename ScannerT>
    const boost::spirit::classic::functor_parser<
        typename vrml97_grammar<Actions, ErrorHandler>::template definition<ScannerT>::
        template mftype_parser<boost::spirit::classic::functor_parser<openvrml::bool_parser> > >
    x3d_vrml_grammar<Actions, ErrorHandler>::definition<ScannerT>::mfbool_p =
        typename vrml97_grammar<Actions, ErrorHandler>::template definition<ScannerT>::
        template mftype_parser<
            boost::spirit::classic::functor_parser<openvrml::bool_parser>
        >(bool_p);

This is eliciting an error message from g++ 4.5:

In file included from libopenvrml/openvrml/basetypes.cpp:23:0:
libopenvrml/openvrml/x3d_vrml_grammar.h:726:68: error: conflicting declaration 'const boost::spirit::classic::functor_parser<typename openvrml::vrml97_grammar<Actions, ErrorHandler>::definition<ScannerT>::mftype_parser<boost::spirit::classic::functor_parser<openvrml::bool_parser> > > openvrml::x3d_vrml_grammar<Actions, ErrorHandler>::definition<ScannerT>::mfbool_p'
libopenvrml/openvrml/x3d_vrml_grammar.h:651:17: error: 'openvrml::x3d_vrml_grammar<Actions, ErrorHandler>::definition<ScannerT>::mfbool_p' has a previous declaration as 'const boost::spirit::classic::functor_parser<typename openvrml::vrml97_grammar<Actions, ErrorHandler>::definition<ScannerT>::mftype_parser<boost::spirit::classic::functor_parser<openvrml::bool_parser> > > openvrml::x3d_vrml_grammar<Actions, ErrorHandler>::definition<ScannerT>::mfbool_p'
libopenvrml/openvrml/x3d_vrml_grammar.h:726:68: error: declaration of 'const boost::spirit::classic::functor_parser<typename openvrml::vrml97_grammar<Actions, ErrorHandler>::definition<ScannerT>::mftype_parser<boost::spirit::classic::functor_parser<openvrml::bool_parser> > > openvrml::x3d_vrml_grammar<Actions, ErrorHandler>::definition<ScannerT>::mfbool_p' outside of class is not definition

This code was accepted by gcc 4.4. If there is a legitimate syntax issue here, I'm not sure what it is.

Version-Release number of selected component (if applicable):
4.5.0-3.fc14
Comment 1 Jakub Jelinek 2010-08-11 03:04:18 EDT
Please provide preprocessed source and the g++ options used to compile it.
Comment 2 Braden McDaniel 2010-08-11 11:39:04 EDT
If there's a way to obtain that from koji, I don't know what it is.

I don't have other access to a machine with gcc 4.5 at the moment, so it's rather difficult for me to get the preprocessed source. This can be reproduced by building the openvrml package on the F14 or development branches.
Comment 3 Jakub Jelinek 2010-08-12 12:56:41 EDT
Just build it with mock...
Comment 4 Braden McDaniel 2010-09-06 00:45:51 EDT
Created attachment 443222 [details]
Preprocessed source

The command line being used to compile:

g++ -DHAVE_CONFIG_H -I. -I.. -I../src/libopenvrml -I../src/libopenvrml -I../src/local/libopenvrml-dl -DOPENVRML_LIBDIR_=\"/usr/lib64\" -DOPENVRML_PKGDATADIR_=\"/usr/share/openvrml\" -DOPENVRML_PKGLIBDIR_=\"/usr/lib64/openvrml\" -DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS -DBOOST_MPL_LIMIT_VECTOR_SIZE=30 -I/usr/lib/jvm/java/include -I/usr/lib/jvm/java/include/linux -DNDEBUG -I/usr/include/freetype2 -pthread -I/usr/include/libxml2 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fvisibility=hidden -fvisibility-inlines-hidden -Wno-missing-braces -Wno-strict-aliasing -Wno-unused-variable -c libopenvrml/openvrml/basetypes.cpp  -fPIC -DPIC -o libopenvrml/openvrml/.libs/libopenvrml_libopenvrml_la-basetypes.o
Comment 5 Jakub Jelinek 2010-09-06 06:12:37 EDT
Dodji, this error starts appearing with r156316 (i.e. your PR42713 + PR42820 patch).  Can you please look at it?  -O0 is enough to reproduce (with # lines stripped -O0 -std=gnu++0x).
Comment 6 Jakub Jelinek 2010-09-06 07:02:21 EDT
Hopefully correctly simplified testcase, at least I get the same error on it with r156316 and no error with r156312.

template <typename S, typename T>
struct C
{
  template <typename U>
  struct B
  {
    template <typename W>
    struct E
    {
      explicit E(const W &x) : w(x) {}
      const W &w;
    };
  };
};
struct F;
template <typename X>
struct D
{
  D() {}
};
const D<F> g;
template <typename S, typename T>
struct A
{
  template <typename U>
  struct B : C<S, T>::template B<U>
  {
    typedef typename C<S, T>::template B<U> V;
    static const D<typename V::template E<D<F> > > a;
  };
};
template <typename S, typename T>
template <typename U>
const D<typename C<S, T>::template B<U>::template E<D<F> > >
A<S, T>::B<U>::a = typename C<S, T>::template B<U>::template E<D<F> >(g);
Comment 7 Dodji Seketeli 2010-09-07 03:14:55 EDT
This should be fixed in this upstream problem report http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45558
Comment 8 Fedora Update System 2010-09-07 08:33:11 EDT
gcc-4.5.1-3.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/gcc-4.5.1-3.fc14
Comment 9 Fedora Update System 2010-09-07 14:37:47 EDT
gcc-4.5.1-3.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update gcc'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/gcc-4.5.1-3.fc14
Comment 10 Fedora Update System 2010-09-10 23:35:52 EDT
gcc-4.5.1-3.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.