[llvm-bugs] [Bug 37030] New: Clang-cl confuses variable method with class constructor when named the same, within noexcept(...)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 6 00:18:00 PDT 2018


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

            Bug ID: 37030
           Summary: Clang-cl confuses variable method with class
                    constructor when named the same, within noexcept(...)
           Product: new-bugs
           Version: 6.0
          Hardware: PC
                OS: other
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: jtfrederico at hrl.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20168
  --> https://bugs.llvm.org/attachment.cgi?id=20168&action=edit
Example of bug

Overview
========

When trying to automatically determine if a templated method is noexcept,
clang-cl confuses an argument's method for the class's constructor when named
the same. It also seems to be unable to find the variable's method. It's
easiest to refer to the simple example I've created, see attached.

Steps to Reproduce
==================

Compile the example main.cpp file with clang-cl, no extra switches required.

Actual Results
==============

When compiling main.cpp with clang-cl, a warning and two errors are produced.

Line 17 warning: explicit constructor calls are a Microsoft extension. It
appears that the compiler is mistaking `bar()' part of `t.bar()' for the
constructor for the class `bar'.

Line 17 error: no member named 'bar' in 'A': This isn't true, there is a member
`bar' in `A'.

Line 17 error: no member named 'bar' in 'B': This isn't true, there is a member
`bar' in `B'.

Expected Results
================

A working binary.

Build Date & Hardware
=====================

Windows 7 Clang-cl 5.0.1 64-bit from http://releases.llvm.org/download.html.

Additional Builds and Platforms
===============================

MacOS 10.12.6, Clang-cl 5.0.1 and 6.0.0 from macports has this bug as well. I
don't quite know how clang-cl exists on MacOS, but it does.

Additional Information
======================

Clang (on MacOS) and clang++ do not have this issue and produce working
binaries when using the flag -std=c++11.

-- 
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/20180406/efc1114f/attachment.html>


More information about the llvm-bugs mailing list