[Bug c++/89537] New: missing location for error

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 28 15:02:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89537

            Bug ID: 89537
           Summary: missing location for error
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

The attached code fails to compile (with -std=gnu++20) because it does
addressof(fm->keys) instead of addressof(fm->keys()).

The error is ecpected, but it fails to show the location where the error
happens, just showing "cc1plus" instead:

inc/flat_map: In instantiation of 'std::_Flat_map_iterator<_KeyCont,
_MappedCont, _IsConst>::_Flat_map_iterator(std::flat_map<typename
_KeyCont::value_type, typename _MappedCont::value_type, _Compare, _KeyCont,
_MappedCont>*, std::size_t) [with _Compare = std::less<void>; _KeyCont =
std::vector<int, std::pmr::polymorphic_allocator<int> >; _MappedCont =
std::vector<int, std::allocator<int> >; bool _IsConst = false; typename
_MappedCont::value_type = int; typename _KeyCont::value_type = int; std::size_t
= long unsigned int]':
inc/flat_map:522:50:   required from 'std::flat_map< <template-parameter-1-1>,
<template-parameter-1-2>, <template-parameter-1-3>, <template-parameter-1-4>,
<template-parameter-1-5> >::iterator std::flat_map< <template-parameter-1-1>,
<template-parameter-1-2>, <template-parameter-1-3>, <template-parameter-1-4>,
<template-parameter-1-5> >::begin() [with _Key = int; _Tp = int; _Compare =
std::less<void>; _KeyContainer = std::vector<int,
std::pmr::polymorphic_allocator<int> >; _MappedContainer = std::vector<int,
std::allocator<int> >; std::flat_map< <template-parameter-1-1>,
<template-parameter-1-2>, <template-parameter-1-3>, <template-parameter-1-4>,
<template-parameter-1-5> >::iterator = std::_Flat_map_iterator<std::vector<int,
std::pmr::polymorphic_allocator<int> >, std::vector<int, std::allocator<int> >,
false>]'
flat_map.cc:9:11:   required from here
cc1plus: error: invalid use of non-static member function 'const
key_container_type& std::flat_map< <template-parameter-1-1>,
<template-parameter-1-2>, <template-parameter-1-3>, <template-parameter-1-4>,
<template-parameter-1-5> >::keys() const [with _Key = int; _Tp = int; _Compare
= std::less<void>; _KeyContainer = std::vector<int,
std::pmr::polymorphic_allocator<int> >; _MappedContainer = std::vector<int,
std::allocator<int> >; std::flat_map< <template-parameter-1-1>,
<template-parameter-1-2>, <template-parameter-1-3>, <template-parameter-1-4>,
<template-parameter-1-5> >::key_container_type = std::vector<int,
std::pmr::polymorphic_allocator<int> >]'
In file included from flat_map.cc:1:
inc/flat_map:771:7: note: declared here
  771 |       value_compare value_comp() const { return
value_compare(key_comp()); }
      |       ^~~~
cc1plus: error: invalid use of non-static member function 'const
mapped_container_type& std::flat_map< <template-parameter-1-1>,
<template-parameter-1-2>, <template-parameter-1-3>, <template-parameter-1-4>,
<template-parameter-1-5> >::values() const [with _Key = int; _Tp = int;
_Compare = std::less<void>; _KeyContainer = std::vector<int,
std::pmr::polymorphic_allocator<int> >; _MappedContainer = std::vector<int,
std::allocator<int> >; std::flat_map< <template-parameter-1-1>,
<template-parameter-1-2>, <template-parameter-1-3>, <template-parameter-1-4>,
<template-parameter-1-5> >::mapped_container_type = std::vector<int,
std::allocator<int> >]'
inc/flat_map:774:7: note: declared here
  774 |       keys() const noexcept { return _M_impl.keys; }
      |       ^~~~~~


I haven't tried to reduce this yet.


More information about the Gcc-bugs mailing list