[llvm-bugs] [Bug 27221] member function of template instantiated even though only declaration is needed

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 5 22:32:09 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27221

Roland <rbock at eudoxos.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #3 from Roland <rbock at eudoxos.de> ---
Sorry, if I am a bit obnoxious about this. But I am having trouble with the
given explanation:

If I remove the definition of the move constructor, the code compiles and links
just fine with every compiler I could get my hands on (gcc, clang, msvc).

template<typename T>
struct X
{
  X() = default;

  X(X&&);
};

auto impl() -> X<int>
{
  return {};
}

auto test() -> decltype(impl())
{
  return impl();
}

int main()
{
  test();
}


Thus, the implementation does not seem to be required. According to the given
explanation, this depends on the current mood of the compiler, and they could
all fail to compile tomorrow. Thus, it is not deterministic whether or not this
code can be compiled.

Then maybe what I reported is not a bug in clang but a bug in the standard?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160406/10ab343d/attachment-0001.html>


More information about the llvm-bugs mailing list