Opened 12 years ago
Closed 12 years ago
#4453 closed Bugs (fixed)
is_virtual_base_of uses common names for internal types (X and Y); naming conflicts result
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | type_traits |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: |
Description
is_virtual_base_of (and probably a lot of other type traits, I suspect) uses some structs internally, X and Y, which inherit from the types being analyzed. But if the derived type under analysis (from which Y inherits) has a method Y, the constructor Y::Y in the internal struct becomes a problem. (At least, under gcc 4.5.0 20100520 prerelease.)
I've attached a simple demonstration of the problem. I attempted to compile with: g++ -c MyDerived.cpp.
One obvious solution to this problem is to change X and Y to have bizarre names that are unlikely to conflict with user code. I have attached a patch to this effect. However, I suspect that this problem occurs in many other type traits.
I'm not enough of a C++ spec expert to say whether my program ought to compile or not. Sorry. The real-world case from which my example was distilled is known to compile on MSVC++. I do not have access to MSVC++ to test my distillation.
Attachments (3)
Change History (5)
by , 12 years ago
comment:1 by , 12 years ago
Status: | new → assigned |
---|
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Patch for the problem