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

             Bug #: 53132
           Summary: Missing top level in diagnostic's instantiation stack
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: jyass...@gcc.gnu.org


gcc-4.7's diagnostic about a private copy constructor skips some levels in the
template instantiation stack:

$ cat test.cc
#include <utility>
class Uncopyable {  // 2
 public:
  Uncopyable() = default;
 private:
  Uncopyable(const Uncopyable&);  // 6
};
class ContainsUncopyable {
  std::pair<Uncopyable, int> pv;  // 9
};
void foo() {
  ContainsUncopyable c;  // 12
}

$ g++-4.7pre -c -std=c++11 test.cc
.../include/c++/4.7.1/type_traits: In substitution of ‘template<class _From1,
class _To1> static decltype ((__test_aux<_To1>(declval<_From1>()),
std::__sfinae_types::__one())) std::__is_convertible_helper<_From, _To,
false>::__test(int) [with _From1 = _From1; _To1 = _To1; _From = const
Uncopyable&; _To = Uncopyable] [with _From1 = const Uncopyable&; _To1 =
Uncopyable]’:
.../include/c++/4.7.1/type_traits:1258:70:   required from ‘constexpr const
bool std::__is_convertible_helper<const Uncopyable&, Uncopyable, false>::value’
.../include/c++/4.7.1/type_traits:1263:12:   required from ‘struct
std::is_convertible<const Uncopyable&, Uncopyable>’
.../include/c++/4.7.1/type_traits:116:12:   required from ‘struct
std::__and_<std::is_convertible<const Uncopyable&, Uncopyable>,
std::is_convertible<const int&, int> >’
.../include/c++/4.7.1/bits/stl_pair.h:113:38:   required from here
test.cc:6:3: error: ‘Uncopyable::Uncopyable(const Uncopyable&)’ is private
In file included from .../include/c++/4.7.1/bits/move.h:57:0,
                 from .../include/c++/4.7.1/bits/stl_pair.h:61,
                 from .../include/c++/4.7.1/utility:72,
                 from test.cc:1:
.../include/c++/4.7.1/type_traits:1252:2: error: within this context

# 3 more similar errors omitted


This diagnostic is less readable than it should be because it omits the code I
wrote at test.cc:9 or test.cc:12, which caused the template at stl_pair.h:113
to be instantiated.

I've only seen this in C++11 mode because the std::pair enable_if is only
present there.


$ g++-4.7pre --version
g++-4.7pre (GCC) 4.7.1 20120412 (prerelease)

Reply via email to