[all-commits] [llvm/llvm-project] eaea5f: [clang] Add test for CWG110 "Can template function...
Vlad Serebrennikov via All-commits
all-commits at lists.llvm.org
Tue Oct 8 11:41:55 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: eaea5f6f952b6059cebfe87ea9800a3a6516f9ed
https://github.com/llvm/llvm-project/commit/eaea5f6f952b6059cebfe87ea9800a3a6516f9ed
Author: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: 2024-10-08 (Tue, 08 Oct 2024)
Changed paths:
M clang/test/CXX/drs/cwg1xx.cpp
M clang/www/cxx_dr_status.html
Log Message:
-----------
[clang] Add test for CWG110 "Can template functions and classes be declared in the same scope?" (#111446)
[P1787R6](https://wg21.link/p1787r6):
> [CWG110](https://cplusplus.github.io/CWG/issues/110.html) is resolved
by reducing the restriction in [temp.pre] to a note (matching the
behavior of GCC, Clang, and ICC).
Wording: see changes to [temp.pre]/7
I believe the wording for the questions raised in the issue is now the
definition of corresponding declarations that is given in
[[basic.scope.scope]/4](https://eel.is/c++draft/basic.scope#scope-4):
> Two declarations correspond if they (re)introduce the same name, both
declare constructors, or both declare destructors, unless
> — either is a using-declarator, or
> — one declares a type (not a typedef-name) and the other declares a
variable, non-static data member other than of an anonymous union
([class.union.anon]), enumerator, function, or function template, or
> — each declares a function or function template and they do not
declare corresponding overloads.
Then it's used as an input for the definition of potentially conflicting
declarations given in
[[basic.scope.scope]/6](https://eel.is/c++draft/basic.scope#scope-6).
Answering the question in the title: yes, having a function template and
a type with the same name that has the same target scope is well-formed.
A keen eye might spot that the current
[[temp.pre]/7](https://eel.is/c++draft/temp.pre#7) note doesn't reflect
all of the exceptions from the definition of corresponding declarations
in [basic.scope.scope]/4, namely 4.1 and 4.2. I believe the note is
defective, and I opened an editorial PR against the draft to fix that:
https://github.com/cplusplus/draft/pull/7284.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list