Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6989505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:13:14+00:00 2026-05-27T19:13:14+00:00

I am trying to compile a small c++ program using clang with the default

  • 0

I am trying to compile a small c++ program using clang with the default C++ standard library(4.6.2) on Fedora. Clang itself compiles okay and a test program using only compiles and runs fine.

My other program uses ropes which clang complains about.

/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../include/c++/4.6.2/ext/ropeimpl.h:433:2:
error: use of
undeclared identifier ‘_Data_allocate’
_Data_allocate(_S_rounded_up_size(__old_len + __len));

A bug was filed against clang for this error message and the resolution was clang is correct, the library code is invalid.

Clang is correct here. There are no type-dependent arguments in the
call to
_Data_allocate, so name lookup fails at template definition time.

The context for the failing code:

  // Concatenate a C string onto a leaf rope by copying the rope data.
  // Used for short ropes.
  template <class _CharT, class _Alloc>
    typename rope<_CharT, _Alloc>::_RopeLeaf*
    rope<_CharT, _Alloc>::
    _S_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter, size_t __len)
    {
      size_t __old_len = __r->_M_size;
      _CharT* __new_data = (_CharT*)
    _Data_allocate(_S_rounded_up_size(__old_len + __len));
      _RopeLeaf* __result;

      uninitialized_copy_n(__r->_M_data, __old_len, __new_data);
      uninitialized_copy_n(__iter, __len, __new_data + __old_len);
      _S_cond_store_eos(__new_data[__old_len + __len]);
      __try
    {
      __result = _S_new_RopeLeaf(__new_data, __old_len + __len,
                     __r->_M_get_allocator());
    }
      __catch(...)
    {
      _RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len,
                      __r->_M_get_allocator());
      __throw_exception_again;
    }
      return __result;
    }

My question is, if this code is not valid, is there an easy workaround? g++ compiles this okay.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:13:15+00:00Added an answer on May 27, 2026 at 7:13 pm

    Digging through the libstdc++ source, it appears that the definition of member function _Data_allocate results from an expansion of the __ROPE_DEFINE_ALLOCS macro in the definition of template _Rope_base (note that template instantiation rope<_CharT, _Alloc> publicly extends _Rope_base<_CharT, _Alloc>).

    You could try qualifying the call to _Data_allocate further. Instead of:

    _Data_allocate(_S_rounded_up_size(__old_len + __len));
    

    Try:

    _Rope_base<_CharT, _Alloc>::_Data_allocate(_S_rounded_up_size(__old_len + __len));
    

    Or simply:

    _Base::_Data_allocate(_S_rounded_up_size(__old_len + __len));
    

    because of the protected typedef _Rope_base<_CharT, _Alloc> _Base; in the definition of rope<_CharT, _Alloc>.

    EDIT: I don’t have Clang installed locally, but I tested this out with the online Clang 3.0 compiler demo.

    This highly pared-down version fails to compile with Clang 3.0 (error: use of undeclared identifier ‘_Data_allocate’):

    #include <cstddef>
    #include <memory>
    
    template <typename _CharT, class _Alloc>
    class _Rope_base : public _Alloc
    {
    public:
        typedef typename _Alloc::template rebind<_CharT>::other _DataAlloc;
        static _CharT * _Data_allocate(std::size_t __n) {
            return _DataAlloc().allocate(__n);
        }
    };
    
    template <typename _CharT, class _Alloc = std::allocator<_CharT> >
    class rope : public _Rope_base<_CharT, _Alloc>
    {
    protected:
        typedef _Rope_base<_CharT, _Alloc> _Base;
    
    public:
        rope()
        {
            _Data_allocate(0);
        }
    };
    
    int main()
    {
        rope<char> r;
    }
    

    By qualifying the call to _Data_allocate in either way suggested above, Clang 3.0 succeeds in compiling it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to compile a small OpenCV program using Eclipse. I'm limited in library
I'm trying to compile a small COM dll (using visual studio 2008 pro), and
I have a small program that which is confusing me. I am trying using
I'm beginner in Java, I'm trying to compile some small program, can somebody explain
While trying to compile a 64 bit linux kernel using gcc, I see the
I'm trying to compile a program called ngrep, and when I ran configure, things
Trying to write this small program to help me in my Stats class, everything
I am trying to compile a small .c file that has the following includes:
I'm trying to compile a small Qt application for windows Mobile 5. so I've
I am trying to write a small media player using GTK+ and GStreamer and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.