public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105045] New: [modules] Can't deduce defaulted template parameter
@ 2022-03-24 16:35 johelegp at gmail dot com
  2022-10-18 14:58 ` [Bug c++/105045] " cvs-commit at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: johelegp at gmail dot com @ 2022-03-24 16:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105045

            Bug ID: 105045
           Summary: [modules] Can't deduce defaulted template parameter
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/3WMd4T48h.

`mod.cpp`:
```C++
export module mod;
export template<int T=0, class U> void f(U) { }
```

`test.cpp`:
```C++
import mod;
int main() { f(0); }
```

Output:
```
test.cpp: In function 'int main()':
test.cpp:2:15: error: no matching function for call to 'f(int)'
    2 | int main() { f(0); }
      |              ~^~~
In module mod, imported at /app/test.cpp:1:
mod.cpp:2:40: note: candidate: 'template<int T, class U> void f@mod(U)'
    2 | export template<int T=0, class U> void f(U) { }
      |                                        ^
mod.cpp:2:40: note:   template argument deduction/substitution failed:
test.cpp:2:15: note:   couldn't deduce template parameter 'T'
    2 | int main() { f(0); }
      |              ~^~~
```

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/105045] [modules] Can't deduce defaulted template parameter
  2022-03-24 16:35 [Bug c++/105045] New: [modules] Can't deduce defaulted template parameter johelegp at gmail dot com
@ 2022-10-18 14:58 ` cvs-commit at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-18 14:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105045

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |13.0
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:0101137c7c5d612c0624f9a2fd5198b302243f85

commit r13-3362-g0101137c7c5d612c0624f9a2fd5198b302243f85
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Oct 18 10:57:30 2022 -0400

    c++ modules: stream non-trailing default targs [PR105045]

    This fixes the below testcase in which we neglect to stream the default
    argument for T only because the subsequent parameter U doesn't also have
    a default argument.

            PR c++/105045

    gcc/cp/ChangeLog:

            * module.cc (trees_out::tpl_parms_fini): Don't assume default
            template arguments must be trailing.
            (trees_in::tpl_parms_fini): Likewise.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/pr105045_a.C: New test.
            * g++.dg/modules/pr105045_b.C: New test.

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed on trunk

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-18 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 16:35 [Bug c++/105045] New: [modules] Can't deduce defaulted template parameter johelegp at gmail dot com
2022-10-18 14:58 ` [Bug c++/105045] " cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).