- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Getting compile error for the following code segment on ICL 16.0.3.207. The code compiles fine on Visual Studio, GCC and clang.
#include <tuple> void foobar() { struct A; A* a = nullptr; std::tuple<const A&> t {std::tie(*a)}; }
The problem seems to be triggered by incomplete types.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Isn't dereferencing a nullptr undefined? (Compiler can do whatever)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
olzhas r. wrote:
Isn't dereferencing a nullptr undefined? (Compiler can do whatever)
That would be an error if I'm dereferencing pointer to value (eg. A* to A). Dereferencing pointer to reference is legal (eg. A* to A&). The compiler has no problems with this in the call to tie(). The problem I'm trying to highlight is that the compiler refuses to construct tuple<const A&> from tuple<A&> when A is an incomplete type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes I can reproduce this problem in our Windows compiler. It's ok in our Linux compiler.
I opened DPD200413633 in our internal bug tracking database. Thank you for reporting it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
JJ wrote:
That would be an error if I'm dereferencing pointer to value (eg. A* to A). Dereferencing pointer to reference is legal (eg. A* to A&).
It is still not legal. It would mean a null reference were defined in C++.: http://stackoverflow.com/questions/2727834/c-standard-dereferencing-null-pointer-to-get-a-reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The workaround would be to declare the complete type of S before the rest of the code.
the problem seems to revolve around an incompatibility in the Intel compiler's __is_convertible_to type trait, i.e.
this compiles with MSVC++ 2015 but not Intel. Thanks for reporting it to us.
struct A;
template<class _This>
struct C
{
static_assert(__is_convertible_to(const _This&, _This), "FAIL");
};
C<A&> _Ttype
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, still seeing the bug in ICL 18.0.1.156
Regression, or was this never fixed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This bug is still open

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page