[llvm-bugs] [Bug 38294] compilation error when parameters have certain complexity

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 25 07:32:11 PDT 2018


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

David Blaikie <dblaikie at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
                 CC|                            |dblaikie at gmail.com,
                   |                            |richard-llvm at metafoo.co.uk
             Status|NEW                         |RESOLVED

--- Comment #1 from David Blaikie <dblaikie at gmail.com> ---
Richard can correct me if I'm wrong here, but I think this code is invalid,
though no diagnostic is required.

The complexity of the code doesn't seem to matter to Clang rejecting this and
GCC accepting it. I could maintain that invariant (using GCC 8.1 at least - I
don't have a dev revision of GCC built) while reducing the test down to:

class foo {
  void operator+(const foo &x) const;
};
template <int footemplate> void foo_function(foo A, foo B) { A + B; }

Once 'foo_function' isn't a template (or if that template is instantiated in
any way) GCC also rejects this.

C++ doesn't require the compiler to diagnose these sort of cases of invalid
non-dependent expressions - Clang does, GCC doesn't, those are both acceptable
implementations. It'd be a minor quality-of-implementation improvement if GCC
rejected this, since all instantiations of the template are invalid.

-- 
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/20180725/be4cfc35/attachment-0001.html>


More information about the llvm-bugs mailing list