[llvm-bugs] [Bug 43775] New: Wc++98-compat + CTAD = bogus warning about 'auto' when no 'auto' appears in the code

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 23 08:30:31 PDT 2019


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

            Bug ID: 43775
           Summary: Wc++98-compat + CTAD = bogus warning about 'auto' when
                    no 'auto' appears in the code
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arthur.j.odwyer at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

cat >test.cc <<EOF
// https://godbolt.org/z/5x5V5v
template<class T> struct S {};
void f() {
    S<int> s;
    S t = s;
}
EOF
clang++ -std=c++17 -Wc++98-compat test.cc

The codegen is fine, but the first warning issued is both redundant AND
technically incorrect. No 'auto' type specifier exists in this code, so Clang
really shouldn't be warning about any 'auto' type specifier.

===
test.cc:4:5: warning: 'auto' type specifier is incompatible with C++98
[-Wc++98-compat]
    S t = s;
    ^

test.cc:4:5: warning: class template argument deduction is incompatible with
C++ standards before C++17; for compatibility, use explicit type name 'S<int>'
[-Wc++98-c++11-c++14-compat]
    S t = s;
    ^

2 warnings generated.
===

-- 
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/20191023/9c44dc48/attachment.html>


More information about the llvm-bugs mailing list