public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/41972] New: static reference as a template parameter fails
@ 2009-11-06 16:37 navinkumar+bugs at gmail dot com
2009-11-06 16:39 ` [Bug c++/41972] " navinkumar+bugs at gmail dot com
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: navinkumar+bugs at gmail dot com @ 2009-11-06 16:37 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]
in certain cases, GCC is unable to pass a static reference as a template
parameter.
SCENARIO 1 (SUCCEEDS):
//test1.cpp
template <typename T>
class X {
public:
static const T x;
};
template <typename T>
class Y {
public:
typedef X<T> wrapper_t;
template <const double& _test_>
class Foo { };
public:
typedef Foo<wrapper_t::x> type;
};
SCENARIO 2 (FAILS):
// test2.cpp
template <typename T>
class X {
public:
static const T x;
};
template <typename _ignore_>
class Y {
public:
typedef X<double> wrapper_t;
template <const double& _test_>
class Foo { };
public:
typedef Foo<wrapper_t::x> type;
};
template class Y<void>;
COMPILER ERROR FOR SCENARIO 2:
test2.cpp:14: error: X<double>::x cannot appear in a constant-expression
test2.cpp:14: error: template argument 1 is invalid
--
Summary: static reference as a template parameter fails
Product: gcc
Version: 4.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: navinkumar+bugs at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41972
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/41972] static reference as a template parameter fails
2009-11-06 16:37 [Bug c++/41972] New: static reference as a template parameter fails navinkumar+bugs at gmail dot com
@ 2009-11-06 16:39 ` navinkumar+bugs at gmail dot com
2009-11-06 16:40 ` navinkumar+bugs at gmail dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: navinkumar+bugs at gmail dot com @ 2009-11-06 16:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from navinkumar+bugs at gmail dot com 2009-11-06 16:39 -------
Created an attachment (id=18983)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18983&action=view)
test1.cpp
test1.cpp (successfully compiles)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41972
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/41972] static reference as a template parameter fails
2009-11-06 16:37 [Bug c++/41972] New: static reference as a template parameter fails navinkumar+bugs at gmail dot com
2009-11-06 16:39 ` [Bug c++/41972] " navinkumar+bugs at gmail dot com
@ 2009-11-06 16:40 ` navinkumar+bugs at gmail dot com
2009-11-06 17:22 ` [Bug c++/41972] [4.3/4.4/4.5 Regression] nondependent static member function as a reference " pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: navinkumar+bugs at gmail dot com @ 2009-11-06 16:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from navinkumar+bugs at gmail dot com 2009-11-06 16:39 -------
Created an attachment (id=18984)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18984&action=view)
test2.cpp
test2.cpp (fails to compile)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41972
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/41972] [4.3/4.4/4.5 Regression] nondependent static member function as a reference template parameter fails
2009-11-06 16:37 [Bug c++/41972] New: static reference as a template parameter fails navinkumar+bugs at gmail dot com
2009-11-06 16:39 ` [Bug c++/41972] " navinkumar+bugs at gmail dot com
2009-11-06 16:40 ` navinkumar+bugs at gmail dot com
@ 2009-11-06 17:22 ` pinskia at gcc dot gnu dot org
2009-11-09 15:28 ` jason at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-06 17:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2009-11-06 17:22 -------
Confirmed, a reduced testcase:
struct X {
static const double x;
};
template <const double& _test_>
class Foo { };
template <typename _ignore_>
struct Y {
typedef Foo<X::x> type;
};
--- CUT ---
If Y is a non template, it works which makes me think we are not binding X::x
to the reference type.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |rejects-valid
Known to fail| |4.0.1 4.4.0 4.5.0
Known to work| |3.3
Last reconfirmed|0000-00-00 00:00:00 |2009-11-06 17:22:18
date| |
Summary|static reference as a |[4.3/4.4/4.5 Regression]
|template parameter fails |nondependent static member
| |function as a reference
| |template parameter fails
Target Milestone|--- |4.3.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41972
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/41972] [4.3/4.4/4.5 Regression] nondependent static member function as a reference template parameter fails
2009-11-06 16:37 [Bug c++/41972] New: static reference as a template parameter fails navinkumar+bugs at gmail dot com
` (2 preceding siblings ...)
2009-11-06 17:22 ` [Bug c++/41972] [4.3/4.4/4.5 Regression] nondependent static member function as a reference " pinskia at gcc dot gnu dot org
@ 2009-11-09 15:28 ` jason at gcc dot gnu dot org
2009-11-09 18:33 ` jason at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-09 15:28 UTC (permalink / raw)
To: gcc-bugs
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jason at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2009-11-06 17:22:18 |2009-11-09 15:27:58
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41972
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/41972] [4.3/4.4/4.5 Regression] nondependent static member function as a reference template parameter fails
2009-11-06 16:37 [Bug c++/41972] New: static reference as a template parameter fails navinkumar+bugs at gmail dot com
` (3 preceding siblings ...)
2009-11-09 15:28 ` jason at gcc dot gnu dot org
@ 2009-11-09 18:33 ` jason at gcc dot gnu dot org
2009-11-09 20:28 ` jason at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-09 18:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jason at gcc dot gnu dot org 2009-11-09 18:33 -------
Subject: Bug 41972
Author: jason
Date: Mon Nov 9 18:32:53 2009
New Revision: 154042
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154042
Log:
PR c++/41972
* parser.c (cp_parser_template_argument): Accept SCOPE_REF around
VAR_DECL.
Added:
trunk/gcc/testsuite/g++.dg/template/ref4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41972
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/41972] [4.3/4.4/4.5 Regression] nondependent static member function as a reference template parameter fails
2009-11-06 16:37 [Bug c++/41972] New: static reference as a template parameter fails navinkumar+bugs at gmail dot com
` (4 preceding siblings ...)
2009-11-09 18:33 ` jason at gcc dot gnu dot org
@ 2009-11-09 20:28 ` jason at gcc dot gnu dot org
2009-11-09 22:01 ` jason at gcc dot gnu dot org
2009-11-09 22:02 ` jason at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-09 20:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jason at gcc dot gnu dot org 2009-11-09 20:28 -------
Subject: Bug 41972
Author: jason
Date: Mon Nov 9 20:28:18 2009
New Revision: 154050
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154050
Log:
PR c++/41972
* parser.c (cp_parser_template_argument): Accept SCOPE_REF around
VAR_DECL.
Added:
branches/gcc-4_4-branch/gcc/testsuite/g++.dg/template/ref4.C
Modified:
branches/gcc-4_4-branch/gcc/cp/ChangeLog
branches/gcc-4_4-branch/gcc/cp/parser.c
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41972
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/41972] [4.3/4.4/4.5 Regression] nondependent static member function as a reference template parameter fails
2009-11-06 16:37 [Bug c++/41972] New: static reference as a template parameter fails navinkumar+bugs at gmail dot com
` (5 preceding siblings ...)
2009-11-09 20:28 ` jason at gcc dot gnu dot org
@ 2009-11-09 22:01 ` jason at gcc dot gnu dot org
2009-11-09 22:02 ` jason at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-09 22:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jason at gcc dot gnu dot org 2009-11-09 22:01 -------
Subject: Bug 41972
Author: jason
Date: Mon Nov 9 22:01:09 2009
New Revision: 154053
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154053
Log:
PR c++/41972
* parser.c (cp_parser_template_argument): Accept SCOPE_REF around
VAR_DECL.
Added:
branches/gcc-4_3-branch/gcc/testsuite/g++.dg/template/ref4.C
Modified:
branches/gcc-4_3-branch/gcc/cp/ChangeLog
branches/gcc-4_3-branch/gcc/cp/parser.c
branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41972
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/41972] [4.3/4.4/4.5 Regression] nondependent static member function as a reference template parameter fails
2009-11-06 16:37 [Bug c++/41972] New: static reference as a template parameter fails navinkumar+bugs at gmail dot com
` (6 preceding siblings ...)
2009-11-09 22:01 ` jason at gcc dot gnu dot org
@ 2009-11-09 22:02 ` jason at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-09 22:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jason at gcc dot gnu dot org 2009-11-09 22:02 -------
Fixed.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41972
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-11-09 22:02 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-06 16:37 [Bug c++/41972] New: static reference as a template parameter fails navinkumar+bugs at gmail dot com
2009-11-06 16:39 ` [Bug c++/41972] " navinkumar+bugs at gmail dot com
2009-11-06 16:40 ` navinkumar+bugs at gmail dot com
2009-11-06 17:22 ` [Bug c++/41972] [4.3/4.4/4.5 Regression] nondependent static member function as a reference " pinskia at gcc dot gnu dot org
2009-11-09 15:28 ` jason at gcc dot gnu dot org
2009-11-09 18:33 ` jason at gcc dot gnu dot org
2009-11-09 20:28 ` jason at gcc dot gnu dot org
2009-11-09 22:01 ` jason at gcc dot gnu dot org
2009-11-09 22:02 ` jason 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).