Bug 49298 - [4.6/4.7 Regression] [C++0x] sorry, unimplemented: unexpected ast of kind field_decl
Summary: [4.6/4.7 Regression] [C++0x] sorry, unimplemented: unexpected ast of kind fi...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.1
: P3 normal
Target Milestone: 4.6.1
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2011-06-06 08:57 UTC by tim blechmann
Modified: 2011-06-06 21:02 UTC (History)
1 user (show)

See Also:
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Build: x86_64-linux-gnu
Known to work: 4.5.2
Known to fail: 4.6.0, 4.7.0
Last reconfirmed: 2011-06-06 09:53:32


Attachments
preprocessed source (183.22 KB, application/x-bzip)
2011-06-06 08:57 UTC, tim blechmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tim blechmann 2011-06-06 08:57:47 UTC
Created attachment 24442 [details]
preprocessed source

using a boost.intrusive header with c++0x support, gcc-4.6 stops with the following error. the same code compiles fine with gcc-4.5 and without c++0x support


/usr/include/boost/intrusive/list.hpp: In static member function ‘static boost::intrusive::list_impl<Config>& boost::intrusive::list_impl<Config>::priv_container_from_end_iterator(const const_iterator&)’:
/usr/include/boost/intrusive/list.hpp:1274:88: sorry, unimplemented: unexpected ast of kind field_decl
/usr/include/boost/intrusive/list.hpp:1274: confused by earlier errors, bailing out

g++ -v:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.6.0-3~ppa1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-multiarch --with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib/x86_64-linux-gnu --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.1 20110409 (prerelease) (Ubuntu 4.6.0-3~ppa1)
Comment 1 Jonathan Wakely 2011-06-06 09:53:32 UTC
reduced:


namespace detail {

template<class Parent, class Member>
inline unsigned offset_from_pointer_to_member(const Member Parent::* ptr_to_member)
{
   const Parent * const parent = 0;
   const char *const member = reinterpret_cast<const char*>(&(parent->*ptr_to_member));
   return unsigned(member - reinterpret_cast<const char*>(parent));
}

template<class Parent, class Member>
inline Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_member)
{
   return (Parent*)((char*)member -
      offset_from_pointer_to_member(ptr_to_member));
}

template<class Parent, class Member>
inline const Parent *parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
{
   return (const Parent*)((const char*)member -
      offset_from_pointer_to_member(ptr_to_member));
}

}


template<class Config>
class list_impl
{
   struct data_t
   {
   } data_;

   data_t* get();

   static void priv_container_from_end_iterator()
   {
      data_t *d = get();
      (void)detail::parent_from_member<list_impl, data_t>(d, &list_impl::data_);
   }

};


interface.cc: In static member function 'static void list_impl<Config>::priv_container_from_end_iterator()':
interface.cc:40:80: sorry, unimplemented: unexpected ast of kind field_decl
interface.cc:40:80: internal compiler error: in potential_constant_expression_1, at cp/semantics.c:7952
Comment 2 Jonathan Wakely 2011-06-06 09:57:59 UTC
Jason, the switch in potential_constant_expression_1 has no FIELD_DECL case
Comment 3 Jason Merrill 2011-06-06 19:42:40 UTC
Author: jason
Date: Mon Jun  6 19:42:38 2011
New Revision: 174721

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174721
Log:
	PR c++/49298
	* semantics.c (potential_constant_expression_1): Handle FIELD_DECL.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Jason Merrill 2011-06-06 20:07:29 UTC
Author: jason
Date: Mon Jun  6 20:07:26 2011
New Revision: 174722

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174722
Log:
	PR c++/49298
	* semantics.c (potential_constant_expression_1): Handle FIELD_DECL.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/regress/ptrmem1.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/semantics.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 5 Jason Merrill 2011-06-06 21:02:27 UTC
Fixed.