[cfe-dev] Recent failing tests in libc++

Marshall Clow via cfe-dev cfe-dev at lists.llvm.org
Mon May 28 12:51:06 PDT 2018


This past week, I checked in a bunch of code (and tests) having to do with
the deduction guides features of C++17 - adding support for many of the
standard library types. Some of the tests started failing - mostly (but not
exclusively) on ARM. JF tried to fix some of the tests on Friday, but was
not completely successful.

Today, I took a fresh look at the failures, and realized that all but one
of them were on bots that were running clang-5.  It appears that clang-5
has a bug where it mis-deduces the template arguments when it is handed
something that looks like a copy constructor. (Alternately, it implicitly
generates an incorrect template deduction guide and uses that.)

A simple example is:
std::optional<char> o1('A');
std::optional o2 = o1;
clang6, clang7 and gcc all agree that decltype(o2) is 'std::optional<char>'.
clang5 believes that the type is 'std::optional<std::optional<char>>'.

This was also causing failures in the deduction tests for the container
adapters, and for std::array as well.

I have marked these tests as UNSUPPORTED in clang5.

Oh yes - and that "all but one" comment above? That was a *.fail test where
clang5 and clang6 give one error message, and clang7 gives a different
one.  We check the error message to make sure we're "failing for the right
reason".

    std::optional opt;

clang5/clang6 gives a (IMHO) bogus error here:
>    declaration of variable 'opt' with deduced type 'std::optional'
requires an initializer
clang7 (and later) give a better message:
>    no viable constructor or deduction guide for deduction of template
arguments of 'optional'

So now we look for either one.

I'm putting this out here so that if anyone else has trouble with implicit
deduction guides in clang 5, hopefully they will find this.

-- Marshall
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180528/e872fec5/attachment.html>


More information about the cfe-dev mailing list