public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template
@ 2008-10-31 0:07 pinskia at gcc dot gnu dot org
2008-10-31 0:08 ` [Bug c++/37971] " pinskia at gcc dot gnu dot org
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-31 0:07 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]
Take:
struct foo
{
private:
template<typename U>
static bool func(const U& x) {}
static bool func1(const int& x) {}
public:
unsigned int Find(const int& x, bool (*pFunc) (const int&) = func) const {}
unsigned int Find1(const int& x, bool (*pFunc) (const int&) = func1) const {}
};
foo b;
void f(void)
{
b.Find1(1);
b.Find(1);
}
--- CUT ---
Only the call to Find is rejected with the following error message:
t.cc: In function void f():
t.cc:5: error: static bool foo::func(const U&) [with U = int] is private
t.cc:16: error: within this context
This is wrong as func is not private in the default argument.
--
Summary: [4.3/4.4 Regression] Rejects default argument that is a
template
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.3/4.4 Regression] Rejects default argument that is a template
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
@ 2008-10-31 0:08 ` pinskia at gcc dot gnu dot org
2008-10-31 0:15 ` [Bug c++/37971] [4.3/4.4 Regression] Rejects default argument that is a template via access failure pinskia at gcc dot gnu dot org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-31 0:08 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.3.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.3/4.4 Regression] Rejects default argument that is a template via access failure
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
2008-10-31 0:08 ` [Bug c++/37971] " pinskia at gcc dot gnu dot org
@ 2008-10-31 0:15 ` pinskia at gcc dot gnu dot org
2008-10-31 0:37 ` [Bug c++/37971] [4.2/4.3/4.4 " pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-31 0:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-10-31 00:13 -------
This is valid code via 8.3.6/5:
"The names in the expressions are bound, and the semantics constraints are
checked, at the point where the default argument expression appears.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.2/4.3/4.4 Regression] Rejects default argument that is a template via access failure
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
2008-10-31 0:08 ` [Bug c++/37971] " pinskia at gcc dot gnu dot org
2008-10-31 0:15 ` [Bug c++/37971] [4.3/4.4 Regression] Rejects default argument that is a template via access failure pinskia at gcc dot gnu dot org
@ 2008-10-31 0:37 ` pinskia at gcc dot gnu dot org
2008-10-31 0:40 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-31 0:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2008-10-31 00:35 -------
Caused by the patch which fixes PR 28588.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mmitchel at gcc dot gnu dot
| |org
Known to fail| |4.4.0 4.3.0 4.2.0
Known to work| |4.1.1 4.0.2
Summary|[4.3/4.4 Regression] Rejects|[4.2/4.3/4.4 Regression]
|default argument that is a |Rejects default argument
|template via access failure |that is a template via
| |access failure
Target Milestone|4.3.3 |4.2.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.2/4.3/4.4 Regression] Rejects default argument that is a template via access failure
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2008-10-31 0:37 ` [Bug c++/37971] [4.2/4.3/4.4 " pinskia at gcc dot gnu dot org
@ 2008-10-31 0:40 ` pinskia at gcc dot gnu dot org
2008-10-31 11:39 ` rguenth at gcc dot gnu dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-31 0:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2008-10-31 00:38 -------
Explictly by the following new code:
{
mark_used (fn);
/* We could not check access when this expression was originally
created since we did not know at that time to which function
the expression referred. */
if (DECL_FUNCTION_MEMBER_P (fn))
{
gcc_assert (access_path);
perform_or_defer_access_check (access_path, fn, fn);
}
}
Since this was already "bound", to the template we should not be performing
access checks for this template function.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.2/4.3/4.4 Regression] Rejects default argument that is a template via access failure
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
` (3 preceding siblings ...)
2008-10-31 0:40 ` pinskia at gcc dot gnu dot org
@ 2008-10-31 11:39 ` rguenth at gcc dot gnu dot org
2008-10-31 17:36 ` mmitchel at gcc dot gnu dot org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-10-31 11:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2008-10-31 11:38 -------
Confirmed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Priority|P3 |P1
Last reconfirmed|0000-00-00 00:00:00 |2008-10-31 11:38:22
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.2/4.3/4.4 Regression] Rejects default argument that is a template via access failure
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
` (4 preceding siblings ...)
2008-10-31 11:39 ` rguenth at gcc dot gnu dot org
@ 2008-10-31 17:36 ` mmitchel at gcc dot gnu dot org
2008-11-05 18:29 ` mmitchel at gcc dot gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2008-10-31 17:36 UTC (permalink / raw)
To: gcc-bugs
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |mmitchel at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.2/4.3/4.4 Regression] Rejects default argument that is a template via access failure
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
` (5 preceding siblings ...)
2008-10-31 17:36 ` mmitchel at gcc dot gnu dot org
@ 2008-11-05 18:29 ` mmitchel at gcc dot gnu dot org
2008-12-10 1:26 ` mmitchel at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2008-11-05 18:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from mmitchel at gcc dot gnu dot org 2008-11-05 18:28 -------
The problem is this:
* We cannot do the full conversion at the point of parsing the default argument
because that may require creation of temporary variables and such. So, in
check_default_arg we call can_convert. But, whether a conversion is possible
or not does not check access because the standard says that access control has
no affect on conversion.
* Later, in covert_default_arg, we do the actual conversion, which triggers an
access-control check.
For default arguments, we need to perform the check in the first case, but not
the second. So, we will need an additional flag to the conversion routines to
indicate that.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.2/4.3/4.4 Regression] Rejects default argument that is a template via access failure
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
` (6 preceding siblings ...)
2008-11-05 18:29 ` mmitchel at gcc dot gnu dot org
@ 2008-12-10 1:26 ` mmitchel at gcc dot gnu dot org
2008-12-11 11:45 ` [Bug c++/37971] [4.2/4.3 " rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2008-12-10 1:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from mmitchel at gcc dot gnu dot org 2008-12-10 01:24 -------
Subject: Bug 37971
Author: mmitchel
Date: Wed Dec 10 01:23:28 2008
New Revision: 142628
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142628
Log:
PR c++/37971
* class.c (resolve_address_of_overloaded_function): Check
accessibility of member functions unless FLAGS indicates
otherwise.
* call.c (standard_conversion): Adjust flags passed to
instantiate_type.
(convert_default_arg): Do not perform access checks.
* cp-tree.h (tsubst_flags_t): Add tf_no_access_control.
PR c++/37971
* g++.dg/overload/defarg2.C: New test.
* g++.dg/overload/defarg3.C: Likewise.
Added:
trunk/gcc/testsuite/g++.dg/overload/defarg2.C
trunk/gcc/testsuite/g++.dg/overload/defarg3.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/cp/class.c
trunk/gcc/cp/cp-tree.h
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.2/4.3 Regression] Rejects default argument that is a template via access failure
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
` (7 preceding siblings ...)
2008-12-10 1:26 ` mmitchel at gcc dot gnu dot org
@ 2008-12-11 11:45 ` rguenth at gcc dot gnu dot org
2008-12-11 17:28 ` mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-12-11 11:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from rguenth at gcc dot gnu dot org 2008-12-11 11:41 -------
Lowering priority - this is not a regression on the branches and trunk is fixed
now.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work|4.1.1 4.0.2 |4.1.1 4.0.2 4.4.0
Priority|P1 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.2/4.3 Regression] Rejects default argument that is a template via access failure
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
` (8 preceding siblings ...)
2008-12-11 11:45 ` [Bug c++/37971] [4.2/4.3 " rguenth at gcc dot gnu dot org
@ 2008-12-11 17:28 ` mmitchel at gcc dot gnu dot org
2009-03-31 21:01 ` [Bug c++/37971] [4.3 " jsm28 at gcc dot gnu dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2008-12-11 17:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from mmitchel at gcc dot gnu dot org 2008-12-11 17:27 -------
Richard --
This is still marked as a 4.2/4.3 regression. So, why shouldn't this remain P1
for 4.3?
Thanks,
-- Mark
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.3 Regression] Rejects default argument that is a template via access failure
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
` (9 preceding siblings ...)
2008-12-11 17:28 ` mmitchel at gcc dot gnu dot org
@ 2009-03-31 21:01 ` jsm28 at gcc dot gnu dot org
2009-08-04 12:43 ` rguenth at gcc dot gnu dot org
2010-05-22 18:27 ` rguenth at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-31 21:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jsm28 at gcc dot gnu dot org 2009-03-31 21:01 -------
Closing 4.2 branch.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.2/4.3 Regression] Rejects|[4.3 Regression] Rejects
|default argument that is a |default argument that is a
|template via access failure |template via access failure
Target Milestone|4.2.5 |4.3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.3 Regression] Rejects default argument that is a template via access failure
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
` (10 preceding siblings ...)
2009-03-31 21:01 ` [Bug c++/37971] [4.3 " jsm28 at gcc dot gnu dot org
@ 2009-08-04 12:43 ` rguenth at gcc dot gnu dot org
2010-05-22 18:27 ` rguenth at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-04 12:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from rguenth at gcc dot gnu dot org 2009-08-04 12:29 -------
GCC 4.3.4 is being released, adjusting target milestone.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.4 |4.3.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/37971] [4.3 Regression] Rejects default argument that is a template via access failure
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
` (11 preceding siblings ...)
2009-08-04 12:43 ` rguenth at gcc dot gnu dot org
@ 2010-05-22 18:27 ` rguenth at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-22 18:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from rguenth at gcc dot gnu dot org 2010-05-22 18:12 -------
GCC 4.3.5 is being released, adjusting target milestone.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.5 |4.3.6
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37971
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2010-05-22 18:27 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-31 0:07 [Bug c++/37971] New: [4.3/4.4 Regression] Rejects default argument that is a template pinskia at gcc dot gnu dot org
2008-10-31 0:08 ` [Bug c++/37971] " pinskia at gcc dot gnu dot org
2008-10-31 0:15 ` [Bug c++/37971] [4.3/4.4 Regression] Rejects default argument that is a template via access failure pinskia at gcc dot gnu dot org
2008-10-31 0:37 ` [Bug c++/37971] [4.2/4.3/4.4 " pinskia at gcc dot gnu dot org
2008-10-31 0:40 ` pinskia at gcc dot gnu dot org
2008-10-31 11:39 ` rguenth at gcc dot gnu dot org
2008-10-31 17:36 ` mmitchel at gcc dot gnu dot org
2008-11-05 18:29 ` mmitchel at gcc dot gnu dot org
2008-12-10 1:26 ` mmitchel at gcc dot gnu dot org
2008-12-11 11:45 ` [Bug c++/37971] [4.2/4.3 " rguenth at gcc dot gnu dot org
2008-12-11 17:28 ` mmitchel at gcc dot gnu dot org
2009-03-31 21:01 ` [Bug c++/37971] [4.3 " jsm28 at gcc dot gnu dot org
2009-08-04 12:43 ` rguenth at gcc dot gnu dot org
2010-05-22 18:27 ` rguenth at gcc dot gnu dot 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).