[llvm-bugs] [Bug 30754] New: Improve error message for: copy construction from explicit conversion function

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 20 21:36:48 PDT 2016


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

            Bug ID: 30754
           Summary: Improve error message for: copy construction from
                    explicit conversion function
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: scheib at chromium.org
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

When attempting to compile something like:
  Optional<int> a;
  bool b = a;

Where Optional has a method:
  constexpr explicit operator bool();

Produces an general conversion error:
  error: no viable conversion from 'Optional<int>' to 'bool'

However, it could be much clearer, e.g.
  error: conversion from 'Optional<int>' to 'bool' disallowed because
Optional<int>::operator bool() is marked 'explicit'. Explicit casting is
required such as 'static_cast<bool>(a)'

-- 
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/20161021/8d178947/attachment-0001.html>


More information about the llvm-bugs mailing list