public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52942] New: [4.7 Regression] using std::ref with a std::unordered_map fails to compile
@ 2012-04-12  0:34 cmaloney at tagged dot com
  2012-04-12  1:18 ` [Bug c++/52942] " paolo.carlini at oracle dot com
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: cmaloney at tagged dot com @ 2012-04-12  0:34 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52942
           Summary: [4.7 Regression] using std::ref with a
                    std::unordered_map fails to compile
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: cmaloney@tagged.com


The following C++ I believe to be valid C++1 , but produces error messages (At
bottom).

$g++ -std=c++11 -c foo.cc

#include <functional>
#include <string>
#include <unordered_map>


struct TFoo {};

namespace std {
  template <>
  struct hash<TFoo> {
    size_t operator()(const TFoo &) const {
      return 0;
    }
  };
}


void f1(std::unordered_map<TFoo, int> &) {}

void f2() {
  std::unordered_map<TFoo, int> map1;
  std::bind(f1, std::ref(map1));
}

In file included from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/functional:50:0,
                 from foo.cc:1:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/functional:
In instantiation of 'constexpr const bool
std::__has_argument_type_helper<std::unordered_map<TFoo, int> >::value':
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/functional:305:1:
  required from 'struct std::__has_argument_type<std::unordered_map<TFoo, int>
>'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/functional:316:12:
  required from 'struct std::_Reference_wrapper_base<std::unordered_map<TFoo,
int> >'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/functional:432:11:
  required from 'class std::reference_wrapper<std::unordered_map<TFoo, int> >'
foo.cc:22:30:   required from here
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_function.h:105:21:
error: 'typedef struct std::pair<const TFoo, int>
std::unary_function<std::pair<const TFoo, int>, const TFoo>::argument_type' is
inaccessible
In file included from foo.cc:1:0:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/functional:305:3:
error: within this context
In file included from
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/functional:50:0,
                 from foo.cc:1:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/functional:
In instantiation of 'struct std::_Reference_wrapper_base_impl<true, false,
std::unordered_map<TFoo, int> >':
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/functional:316:12:
  required from 'struct std::_Reference_wrapper_base<std::unordered_map<TFoo,
int> >'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/functional:432:11:
  required from 'class std::reference_wrapper<std::unordered_map<TFoo, int> >'
foo.cc:22:30:   required from here
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_function.h:105:21:
error: 'typedef struct std::pair<const TFoo, int>
std::unary_function<std::pair<const TFoo, int>, const TFoo>::argument_type' is
inaccessible
In file included from foo.cc:1:0:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/functional:283:43:
error: within this context


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-04-22  8:08 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12  0:34 [Bug c++/52942] New: [4.7 Regression] using std::ref with a std::unordered_map fails to compile cmaloney at tagged dot com
2012-04-12  1:18 ` [Bug c++/52942] " paolo.carlini at oracle dot com
2012-04-12  1:39 ` paolo.carlini at oracle dot com
2012-04-12  8:40 ` [Bug libstdc++/52942] " redi at gcc dot gnu.org
2012-04-12  8:47 ` redi at gcc dot gnu.org
2012-04-12  9:04 ` paolo.carlini at oracle dot com
2012-04-12  9:07 ` redi at gcc dot gnu.org
2012-04-12  9:09 ` redi at gcc dot gnu.org
2012-04-12  9:26 ` [Bug libstdc++/52942] [4.7/4.8 " rguenth at gcc dot gnu.org
2012-04-12  9:33 ` paolo.carlini at oracle dot com
2012-04-12  9:57 ` paolo.carlini at oracle dot com
2012-04-12 10:05 ` redi at gcc dot gnu.org
2012-04-12 10:14 ` paolo.carlini at oracle dot com
2012-04-12 10:27 ` paolo.carlini at oracle dot com
2012-04-12 12:18 ` paolo at gcc dot gnu.org
2012-04-12 12:19 ` paolo at gcc dot gnu.org
2012-04-12 12:20 ` paolo.carlini at oracle dot com
2012-04-22  8:08 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).