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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to