[llvm-bugs] [Bug 40983] New: non-type template-parameter of reference type confuses template specialization matching

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 6 09:37:04 PST 2019


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

            Bug ID: 40983
           Summary: non-type template-parameter of reference type confuses
                    template specialization matching
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++'17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tadeus.prastowo at unitn.it
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Consider the following MWE:
-- 8< ---------------------
template<typename T, T v>
struct X {
};

template<bool &v>
struct X<bool &, v> {
};
-- 8< ---------------------

As shown in https://www.godbolt.org/z/HqqLWu, the MWE is accepted by GCC when
using C++14 (the compilation switches `-std=c++14 -pedantic-errors') and when
using C++17 (the compilation switches `-std=c++17 -pedantic-errors').

Clang also accepts the MWE when using C++14 but _not_ when using C++17.

A thread in the C++ std-discussion has just been started on this matter (see
https://groups.google.com/a/isocpp.org/d/msg/std-discussion/etn0e3qhz28/Nmpmz7NwBAAJ),
but no one has replied yet.  Nevertheless, I think this is a bug considering
that Clang accepts the MWE in C++14, and I think, there is no change in C++17
that justifies Clang behavior in rejecting the MWE in C++17.

This bug may also be related to this bug:
https://bugs.llvm.org/show_bug.cgi?id=39373

-- 
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/20190306/adf75aa3/attachment.html>


More information about the llvm-bugs mailing list