Modify

Ticket #2792 (new Bugs)

Opened 5 years ago

Last modified 13 months ago

HP aCC rejects string_parse_tree <> in string_parse_tree.hpp

Reported by: Max Zinal <MaxZinal@…> Owned by: az_sw_dude
Milestone: To Be Determined Component: date_time
Version: Boost 1.38.0 Severity: Problem
Keywords: Cc:

Description

When trying to use date_time's format_date_parser<> I get errors on string_parse_tree<> template instantiation. The error message says "incomplete type is not allowed", the exact compiler version is HP C/aC++ B3910B A.06.20.

The core reason for the error is that string_parse_tree<> includes the definition of "ptree_coll" and several typedefs above it:

template<typename charT> struct string_parse_tree {

... typedef std::multimap<charT, string_parse_tree > ptree_coll; ... typedef typename ptree_coll::value_type value_type; typedef typename ptree_coll::iterator iterator; ... ptree_coll m_next_chars; ..

};

AFAIK this is not guaranteed to work by the current C++ standard, because string_parse_tree<> is, generally speaking, incomplete at the point of instantiation of ptree_coll.

I asked at comp.lang.c++.moderated, and these are the replies:

 http://groups.google.ru/group/comp.lang.c++.moderated/browse_thread/thread/f04915083b8f0f93/a11c78689cffb71b

Attachments

fix.2792.patch Download (3.7 KB) - added by andrew.c.morrow@… 21 months ago.
Use shared_ptr to build tree, rather than by size self reference.
fix.2792.svn.patch Download (3.8 KB) - added by andrew.c.morrow@… 21 months ago.
a better patch made via "svn diff"
fix.2792.new.patch Download (3.8 KB) - added by andrew.c.morrow@… 21 months ago.
Re-uploading, something seems wrong with the previous upload

Change History

comment:1 Changed 2 years ago by Stuart A. Malone <samalone@…>

I believe I am seeing the same problem with Boost 1.49 under the Xcode 4.4 developer preview 3 using the Apple LLVM compiler 4.0 and libc++ (LLVM C++ standard library with C++11 support. The string_parse_tree class is relying on undefined behavior when it attempts to use itself in the definition of ptree_coll.

I had a similar problem in my own code when I switched to this compiler/library combination, and solved it by using boost::shared_ptr to store a pointer to the sub-object rather than storing the complete object.

Changed 21 months ago by andrew.c.morrow@…

Use shared_ptr to build tree, rather than by size self reference.

comment:2 Changed 21 months ago by andrew.c.morrow@…

I can confirm that this problem exists with Boost 1.50 under XCode 4.5 Developer Preview 2 when building boost with clang++. I've attached a very minimally tested patch against SVN 79489 that implements the shared_ptr fix mentioned by samalome above.

Changed 21 months ago by andrew.c.morrow@…

a better patch made via "svn diff"

comment:3 Changed 21 months ago by andrew.c.morrow@…

  • Milestone changed from Boost 1.39.0 to Boost 1.51.0

Changed 21 months ago by andrew.c.morrow@…

Re-uploading, something seems wrong with the previous upload

comment:4 Changed 21 months ago by andrew.c.morrow@…

Ping? I'd really like to see this fixed for boost 1.51, but my updates in this ticket seem to have not generated much attention. This is a long standing problem in boost date_time and it breaks boost with recent versions of clang. I'm willing to help out with getting it fixed for the upcoming release. What can I do to help?

comment:5 Changed 17 months ago by anonymous

I'm also seeing this problem in clang 4.1, Boost 1.52. Patch appears to work.

comment:6 Changed 13 months ago by anonymous

  • Milestone changed from Boost 1.51.0 to To Be Determined
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.