[llvm-bugs] [Bug 42527] New: Type pretty printing for auto deduced non-type template parameter (P0127R2) in diagnostics can be confusing

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 6 16:18:22 PDT 2019


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

            Bug ID: 42527
           Summary: Type pretty printing for auto deduced non-type
                    template parameter (P0127R2) in diagnostics can be
                    confusing
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: piotr.rak at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 22201
  --> https://bugs.llvm.org/attachment.cgi?id=22201&action=edit
Test case

Since there is no type information about type deduced for auto placeholder in
non-type template parameter while pretty printing in diag, error message can
confuse user.

Please consider code:

template <typename, typename> struct is_same           { enum { value = false};
};
template <typename Ty_>       struct is_same<Ty_, Ty_> { enum { value = true };
};

template <auto> struct nonty_auto {};

using unsigned_auto_t   = nonty_auto< unsigned(0)>;     
using signed_auto_t     = nonty_auto< int(0) >;

static_assert(is_same<unsigned_auto_t, signed_auto_t>::value, "might confuse
user");

That will result in error message:

confusing_P0127R2_pretty_printing.cc:12:1: error: static_assert failed due to
requirement 'is_same<nonty_auto<0>, nonty_auto<0> >::value' "might confuse
user"
static_assert(is_same<unsigned_auto_t, signed_auto_t>::value, "might confuse
user");

Based on that user is not able distinguish between nonty_auto instantiated with
signed and unsigned literal 0.

-- 
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/20190706/71af4638/attachment.html>


More information about the llvm-bugs mailing list