Changes between Initial Version and Version 1 of Ticket #9201, comment 1


Ignore:
Timestamp:
Feb 18, 2014, 12:38:56 PM (9 years ago)
Author:
acharles

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9201, comment 1

    initial v1  
    11I think the only way to fix this is to have the following approach:
    2 
    3 TT* b_ptr = NULL;
    4 if (b_ptr) {
    5   TT& b = *b_ptr;
    6   TT a(b); // Though I wonder if this shouldn't require an implicit copy constructor.
    7   TT* ptr = &a;
    8   ...
    9 }
    10 
     2{{{
     3  TT* b_ptr = NULL;
     4  if (b_ptr) {
     5    TT& b = *b_ptr;
     6    TT a(b); // Though I wonder if this shouldn't require an implicit copy constructor.
     7    TT* ptr = &a;
     8    ...
     9  }
     10}}}
    1111This is the only way I can think of to create an object of type TT without relying on default construction, while also not invoking undefined behavior and also having it require compilation.
    1212