Re: templates

2025-06-14 Thread Jonathan Wakely via Gcc
On Sat, 14 Jun 2025 at 13:32, саша савельев wrote: > > > To whom it may concern > > Why we can’t use in this context? > > #include < iostream > > template < auto N > > void f () { > std::cout << N << std::endl ; > } > int main () { > f < 1 >(); > f < '!' >(); > f < "!!" >(); // e

templates

2025-06-14 Thread саша савельев
To whom it may concern   Why we can’t use in this context?   #include < iostream >   template < auto N > void f () {     std::cout << N << std::endl ; }   int main () {     f < 1 >();     f < '!' >();     f < "!!" >(); // error       return 0 ; }   Alexander and his classmates

Re: Missing DWARF children for variable templates

2023-11-14 Thread Jonathan Wakely via Gcc
On Sat, 11 Nov 2023 at 02:06, Nima Hamidi via Gcc wrote: > > Another similar issue is with alias templates. The following code: Please report both cases to Bugzilla, thanks. > > ``` > template > struct Cls { > using ptr = T *; > }; > > template >

Re: Missing DWARF children for variable templates

2023-11-10 Thread Nima Hamidi via Gcc
Another similar issue is with alias templates. The following code: ``` template struct Cls {  using ptr = T *; }; template using Cls_ptr = typename Cls::ptr; Cls_ptr ai; Cls_ptr af; ``` produces ``` < 1><0x0029> DW_TAG_typedef  DW_AT_type <0x003d>  DW_AT_na

Missing DWARF children for variable templates

2023-11-10 Thread Nima Hamidi via Gcc
Hello all, When I compile ``` template struct Cls {  static const int v = 0; }; template int constexpr Cls_v = Cls::v; int func() {  return Cls_v + Cls_v; } ``` using `g++ -c main.cpp -o main.o -g`, I see two indistinguishable DIEs in the generated debug info: ``` < 1><0x003a> DW_TAG_v

Should templates with multiple instantiations contribute to summaries in gcov?

2022-08-03 Thread Jørgen Kvalsvik
ecuted:100.00% of 10 File 'demo.cc' Lines executed:88.89% of 18 Branches executed:100.00% of 2 Taken at least once:50.00% of 2 Calls executed:100.00% of 4 Creating 'demo.cc.gcov' Lines executed:88.89% of 18 So it reports lines and branches accurately for templates with a single

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-15 Thread Vincent Lefevre
On 2017-05-12 15:59:44 -0500, Daniel Santos wrote: > [...] But from a conceptual standpoint, I believe the term > "constant-expression" would be incorrect because the C standard > defines this constraint: (6.6.3 of C11) "Constant expressions shall > not contain assignment, increment, decrement, fun

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-12 Thread Daniel Santos
or C2X is to increase compatibility with C++, so new language features with that effect have a good chance of being considered. I don't expect C2X to go as far as to add something as complex as templates but some on the committee are working on enhancing support for generic programming (via _Ge

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-12 Thread Joseph Myers
On Fri, 12 May 2017, Daniel Santos wrote: > > Note that while "other forms" might be accepted in initializers, they > > would still not be integer constant expressions (see DR#312). > > What is DR#312? http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_312.htm (but cf the older http://www.open

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-12 Thread Daniel Santos
Sorry for my delayed response. On 05/11/2017 09:35 AM, Joseph Myers wrote: On Thu, 11 May 2017, Jonathan Wakely wrote: On 10 May 2017 at 23:14, Daniel Santos wrote: Well my primary goal is programming with values that are constant in the compiler. There is no language in any C specification

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-12 Thread Martin Sebor
luding the syntax, especially the reuse of the register keyword, are likely to evolve): http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2067.pdf The C committee's charter for C2X is to increase compatibility with C++, so new language features with that effect have a good chance of being cons

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-11 Thread Joseph Myers
On Thu, 11 May 2017, Jonathan Wakely wrote: > On 10 May 2017 at 23:14, Daniel Santos wrote: > > Well my primary goal is programming with values that are constant in the > > compiler. There is no language in any C specification (that I'm aware of) > > for a "compile-time constant", but the concept

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-11 Thread Marek Polacek
On Thu, May 11, 2017 at 11:12:24AM +0100, Jonathan Wakely wrote: > On 10 May 2017 at 23:14, Daniel Santos wrote: > > Well my primary goal is programming with values that are constant in the > > compiler. There is no language in any C specification (that I'm aware of) > > for a "compile-time consta

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-11 Thread Jonathan Wakely
On 10 May 2017 at 23:14, Daniel Santos wrote: > Well my primary goal is programming with values that are constant in the > compiler. There is no language in any C specification (that I'm aware of) > for a "compile-time constant", but the concept is very important. So just > because some expressio

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-10 Thread Daniel Santos
On 05/10/2017 04:24 AM, Jonathan Wakely wrote: Just because there's already one way to do something doesn't mean better ways to do it are bad. I'm only speaking out of jealousy being that most of my recent work has been in C. hadn't gone so far as to investigate using this new attribute on

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-10 Thread Jonathan Wakely
However, I Because writing functions in normal C++ is much simpler and more expressive than writing class templates and recursive partial specializations. Just because there's already one way to do something doesn't mean better ways to do it are bad. > hadn't gone so far as to in

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-10 Thread Daniel Santos
you don't use them. Put simply, there are many projects who will not likely be converting to C++ in the in our lifetimes. As far as abstractions, I meant the abstraction penalty of static types which doesn't exist when using C++ templates (not at run-time anyway). In C, generic

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-10 Thread Daniel Santos
Thanks for your feedback! On 05/09/2017 04:36 AM, Florian Weimer wrote: On 05/09/2017 01:36 AM, Daniel Santos wrote: To further the usefulness of such techniques, I propose the addition of a c-family attribute to declare a parameter, variable (and possibly other declarations) as "constprop" or

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-09 Thread Allan Sandfeld Jensen
On Tuesday 09 May 2017, Daniel Santos wrote: > The primary aim is to facilitate high-performance generic C > libraries for software where C++ is not suitable, but the cost of > run-time abstraction is unacceptable. A good example is the Linux > kernel, where the source tree is littered with more th

Re: [RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-09 Thread Florian Weimer
On 05/09/2017 01:36 AM, Daniel Santos wrote: To further the usefulness of such techniques, I propose the addition of a c-family attribute to declare a parameter, variable (and possibly other declarations) as "constprop" or some similar word. The purpose of the attribute is to: 1.) Emit a warn

[RFC] GCC 8 Project proposal: Extensions supporting C Metaprogramming, pseudo-templates

2017-05-08 Thread Daniel Santos
rce) either cloning or inlining of a function with such a parameter. This will enable the use of pseudo-templates and: 1.) Eliminate the need for __attribute__((always_inline, flatten)) and complicated ASSERT_CONST() macros, 2.) Eliminate the need for an __attribute__((flatten) wrapper function,

Operator "~", decltype() and templates.

2015-02-17 Thread Paweł Tomulik
Hi, the following program does not compile with g++4.9.2: #include template auto tt(T x) -> decltype(~x) // <-- here { return ~x; } int main() { std::cout << tt(10) << std::endl; return EXIT_SUCCESS; } ptomulik@tea:$ g++ -std=c++11 -g -O0 -Wall -Wextra -Werror -pedantic -o test-gcc test.

Re: Operator "~", decltype() and templates.

2015-02-17 Thread Jonathan Wakely
On 17 February 2015 at 15:10, Paweł Tomulik wrote: > Is this a bug? The original program compiles with clang. Yes, please report it as described at https://gcc.gnu.org/bugs/ In any case, "is this a bug?" questions are inappropriate on this mailing list, they belong on the gcc-help list.

Re: Vararg templates. GCC vs Clang

2015-02-06 Thread Jonathan Wakely
On 7 February 2015 at 00:05, Jonathan Wakely wrote: > This question would have been more appropriate on the gcc-help mailing list. I should have said it *was* more appropriate on that list, and should have remained there. You could have pinged the gcc-help list, or just been patient, before sendin

Re: Vararg templates. GCC vs Clang

2015-02-06 Thread Jonathan Wakely
On 6 February 2015 at 12:12, Victor wrote: > > > > --- the forwarded message follows --- > > > -- Forwarded message -- > From: Victor > To: gcc-h...@gcc.gnu.org > Cc: > Date: Wed, 04 Feb 2015 15:41:56 +0600 > Subject: Vararg template

Vararg templates. GCC vs Clang

2015-02-06 Thread Victor
--- the forwarded message follows --- --- Begin Message --- Code: #include #include template void f(std::tuple ) { std::cout << "std::tuple\n"; } template void f(std::tuple ) { std::cout << "std::tuple\n"; } int main() { f(std::tuple{}); } GCC accepts this code silently. But

Re: Use of templates in c code?

2013-02-13 Thread Diego Novillo
On Wed, Feb 13, 2013 at 5:18 PM, wrote: > > On Feb 13, 2013, at 5:04 PM, Diego Novillo wrote: > >> ... >> Ah, so if we rename a file with 'svn rename', its history will be >> preserved across the rename? In that case, renaming files should not >> be a problem. > > Yes, that's one of many ways th

Re: Use of templates in c code?

2013-02-13 Thread Paul_Koning
On Feb 13, 2013, at 5:04 PM, Diego Novillo wrote: > ... > Ah, so if we rename a file with 'svn rename', its history will be > preserved across the rename? In that case, renaming files should not > be a problem. Yes, that's one of many ways that SVN (or most other source control systems) are su

Re: Use of templates in c code?

2013-02-13 Thread Diego Novillo
On Wed, Feb 13, 2013 at 5:00 PM, Joseph S. Myers wrote: > On Wed, 13 Feb 2013, Philip Martin wrote: > >> The new file must have been explicitly added, rather than copied or >> moved, and so the history is broken. An example of a history preserving > > The issue there is that cvs2svn doesn't / didn

Re: Use of templates in c code?

2013-02-13 Thread Joseph S. Myers
On Wed, 13 Feb 2013, Philip Martin wrote: > The new file must have been explicitly added, rather than copied or > moved, and so the history is broken. An example of a history preserving The issue there is that cvs2svn doesn't / didn't at the time support detecting moves, so moves from before the

Re: Use of templates in c code?

2013-02-13 Thread Alec Teal
On 13/02/13 17:11, Jonathan Wakely wrote: On 13 February 2013 17:01, Alec Teal wrote: On 13/02/13 17:00, Jonathan Wakely wrote: I read it. That's not debate, just ill-informed speculation ("cpp is the recommended extension for C++ as far as I know"). We already have C++ code in GCC, the runt

Re: Use of templates in c code?

2013-02-13 Thread Jonathan Wakely
On 13 February 2013 17:01, Alec Teal wrote: > > On 13/02/13 17:00, Jonathan Wakely wrote: >> >> >> I read it. That's not debate, just ill-informed speculation ("cpp is >> the recommended extension for C++ as far as I know"). We already have >> C++ code in GCC, the runtime library uses .cc and the

Re: Use of templates in c code?

2013-02-13 Thread Andrew Haley
On 02/13/2013 05:01 PM, Alec Teal wrote: > Why not rename them to? See the "archaeology" discussion. This is so vitally important to GCC maintainers that you change things at everyone's peril. Andrew.

Re: Use of templates in c code?

2013-02-13 Thread Philip Martin
Diego Novillo writes: > One problem I've noticed is that renames seem to confuse svn diff. > For example: > > $ cd gcc/cp > $ svn log -r81829 cp-gimplify.c > > r81829 | dnovillo | 2004-05-13 22:29:32 -0400 (Thu, 13 May 2004)

Re: Use of templates in c code?

2013-02-13 Thread Alec Teal
On 13/02/13 17:00, Jonathan Wakely wrote: On 13 February 2013 16:32, Alec Teal wrote: On 13/02/13 16:11, Jonathan Wakely wrote: On 13 February 2013 15:33, Alec Teal wrote: A few questions, what is this stage 1? (link to documentation please, or a descriptive answer). See http://gcc.gnu.org/

Re: Use of templates in c code?

2013-02-13 Thread Jonathan Wakely
On 13 February 2013 16:32, Alec Teal wrote: > On 13/02/13 16:11, Jonathan Wakely wrote: >> >> On 13 February 2013 15:33, Alec Teal wrote: >>> >>> A few questions, what is this stage 1? (link to documentation please, or >>> a >>> descriptive answer). >> >> See http://gcc.gnu.org/develop.html >> >>

Re: Use of templates in c code?

2013-02-13 Thread Alec Teal
On 13/02/13 16:11, Jonathan Wakely wrote: On 13 February 2013 15:33, Alec Teal wrote: A few questions, what is this stage 1? (link to documentation please, or a descriptive answer). See http://gcc.gnu.org/develop.html for the choice of file extension, this is really a tiny thing, but I do ha

Re: Use of templates in c code?

2013-02-13 Thread Alec Teal
On 13/02/13 16:24, Jonathan Wakely wrote: On 13 February 2013 15:33, Alec Teal wrote: I'm also thinking of re-writing the C++ parser there are some interesting todos (using lookahead rather than "try the next option") it's a topic I enjoy and something I could (probably) do, especially given a w

Re: Use of templates in c code?

2013-02-13 Thread Jonathan Wakely
On 13 February 2013 15:33, Alec Teal wrote: > I'm also thinking of re-writing the C++ parser there are some interesting > todos (using lookahead rather than "try the next option") it's a topic I > enjoy and something I could (probably) do, especially given a working > version already. thoughts and

Re: Use of templates in c code?

2013-02-13 Thread Jonathan Wakely
On 13 February 2013 15:33, Alec Teal wrote: > > A few questions, what is this stage 1? (link to documentation please, or a > descriptive answer). See http://gcc.gnu.org/develop.html > for the choice of file extension, this is really a tiny thing, but I do have > a reason for .cpp > http://stacko

Re: Use of templates in c code?

2013-02-13 Thread Andrew Haley
On 02/13/2013 03:06 PM, Diego Novillo wrote: > One problem I've noticed is that renames seem to confuse svn diff. For > example: > > $ cd gcc/cp > $ svn log -r81829 cp-gimplify.c > > r81829 | dnovillo | 2004-05-13 22:29:32

Re: Use of templates in c code?

2013-02-13 Thread Alec Teal
On 13/02/13 13:47, Diego Novillo wrote: I feel silly now, why not use .cpp? SVN's move not good enough? (or is it just because no one could be bothered?) The latter. Perhaps we should start renaming the files. It will help with this confusion and it will also be useful for tools like editors

Re: Use of templates in c code?

2013-02-13 Thread Diego Novillo
On Wed, Feb 13, 2013 at 9:59 AM, Ian Lance Taylor wrote: > I have no opinion on whether it is better to rename files now or later. > > I do think it is better to rename the files at some point. > > I would vote for renaming to an extension of ".cc". Likewise. One problem I've noticed is that re

Re: Use of templates in c code?

2013-02-13 Thread Ian Lance Taylor
On Wed, Feb 13, 2013 at 5:47 AM, Diego Novillo wrote: > On Wed, Feb 13, 2013 at 8:31 AM, Alec Teal wrote: >> On 13/02/13 12:39, Richard Biener wrote: >>> >>> On Wed, Feb 13, 2013 at 1:31 PM, Alec Teal wrote: >>> It's just a filename ... we compile it with a C++ compiler. >>> >>> Richard. >> >> I

Re: Use of templates in c code?

2013-02-13 Thread Diego Novillo
On Wed, Feb 13, 2013 at 8:31 AM, Alec Teal wrote: > On 13/02/13 12:39, Richard Biener wrote: >> >> On Wed, Feb 13, 2013 at 1:31 PM, Alec Teal wrote: >> It's just a filename ... we compile it with a C++ compiler. >> >> Richard. > > I feel silly now, why not use .cpp? SVN's move not good enough? >

Re: Use of templates in c code?

2013-02-13 Thread Alec Teal
On 13/02/13 12:39, Richard Biener wrote: On Wed, Feb 13, 2013 at 1:31 PM, Alec Teal wrote: It's just a filename ... we compile it with a C++ compiler. Richard. I feel silly now, why not use .cpp? SVN's move not good enough? (or is it just because no one could be bothered?) Alec I am sorry if

Re: Use of templates in c code?

2013-02-13 Thread Richard Biener
lename ... we compile it with a C++ compiler. Richard. > I am on a different computer now but it was vec< and occurred about 1/6th of > the way in, it should be easy to find. > > Is that allowed? Is my main question. I would support a c with templates it'd > save macro u

Use of templates in c code?

2013-02-13 Thread Alec Teal
in, it should be easy to find. Is that allowed? Is my main question. I would support a c with templates it'd save macro usage, that could only be good! Or is there some construct of c I do not know of. Searching for c templates proved fruitless I got loads of c++ results Alec

Re: Support for export keyword to use with C++ templates ?

2012-03-10 Thread James Dennett
is for somebody to write one. > > > Hello > > Is that statement above still true please ? > > I know export is now to be made deprecated by the next version of the C++ > standard On a point of information: Support for exported templates has been removed, not merely deprecated, in the current version of the C++ standard (C++11). -- James

Re: Support for export keyword to use with C++ templates ?

2012-03-10 Thread Timothy Madden
On 25.01.2010 20:12, Ian Lance Taylor wrote: Timothy Madden writes: [...] g++ is free software. A clean implementation of export would certainly be accepted. All it takes is for somebody to write one. Hello Is that statement above still true please ? I know export is now to be made depr

Re: gcov/-ftest-coverage instrumentation for uninstantiated C++ function templates

2011-04-29 Thread Andi Hellmund
Hey Manuel, I would like to be able to change this behaviour so non-instantiated code templates are considered as blocks (I think this is the term used by GCC/GCov). This would help me greatly to uncover unused/untested codes in a header/template-only library. First of all: Is this feasible

gcov/-ftest-coverage instrumentation for uninstantiated C++ function templates

2011-04-26 Thread Manuel Holtgrewe
Dear all, I would like to instrument uninstantiated C++ function templates. When compiling the program below with the -ftest-coverage and -fprofile- arcs flags, I get according .gcno and .gcda files to run gcov and get a coverage report. In this report, the line marked with XXX will be

Re: Strange behavior with templates and G++

2011-02-17 Thread Jonathan Wakely
On 17 February 2011 17:26, Pascal Francq wrote: > In fact, since it is related on how g++ is implementing its heritage mechanism > in C++, I was thinking it was the right mailing-list. In fact, by adding a > convenient method in Super2, the code compiles : >        template inline void Test(C* ptr)

Re: Strange behavior with templates and G++

2011-02-17 Thread Pascal Francq
In fact, since it is related on how g++ is implementing its heritage mechanism in C++, I was thinking it was the right mailing-list. In fact, by adding a convenient method in Super2, the code compiles : template inline void Test(C* ptr) {Super::Test(ptr);} This trick let me suppose that a

Re: Strange behavior with templates and G++

2011-02-17 Thread Jonathan Wakely
On 17 February 2011 11:03, Pascal Francq wrote: > > Is this a problem related to a misunderstood concept from me, a wrong > implementation or a technical problem of g++ ? In any of those cases, such questions are off-topic on this mailing list, which is for development of gcc, not help using it.

Strange behavior with templates and G++

2011-02-17 Thread Pascal Francq
Hi, While compiling the following code, I got an error : template class Super { public: Super(void) {} void Test(C*) {} }; class A { public: A(void) {} }; class A1 : public A { public: A1(void) : A() {} }; class A2 : public A { public: A2(void) : A() {}

Re: Support for export keyword to use with C++ templates ?

2010-02-06 Thread Kai Henningsen
Dodji Seketeli wrote: > On Sat, Jan 30, 2010 at 01:47:03AM +0200, Timothy Madden wrote: > >> So nobody here wants to try a big thing ? :( >> > > This question strikes me as being not very fair because many GCC people > are already pretty much involved. Would you fancy giving a hand? > >

Re: Support for export keyword to use with C++ templates ?

2010-02-03 Thread Richard Kenner
> It depends on who owns the code that you write. If you own the code, > then you need to sign papers as an individual contributor. I don't think it's that simple. "who owns the code" is not always clear. There's often a question of who that is. That's why if somebody HAS an employer we usually

Re: Support for export keyword to use with C++ templates ?

2010-02-03 Thread Richard Kenner
> I do not know the correct wording in English for this but I am legally > licensed as an individual to offer software consulting services and to > develop software. > > So the so-called employer is really my client, with whom I have signed > a contract for consulting services. If you have exactl

Re: Support for export keyword to use with C++ templates ?

2010-02-03 Thread Ian Lance Taylor
Timothy Madden writes: > On Wed, Feb 3, 2010 at 4:19 AM, Richard Kenner > wrote: >>> I see that what I need is an assignment for all future changes. If my >>> employer is not involved with any contributions of mine, the employer >>> disclaimer is not needed, right ? >> >> It's safest to have it.

Re: Support for export keyword to use with C++ templates ?

2010-02-03 Thread Timothy Madden
On Wed, Feb 3, 2010 at 4:19 AM, Richard Kenner wrote: >> I see that what I need is an assignment for all future changes. If my >> employer is not involved with any contributions of mine, the employer >> disclaimer is not needed, right ? > > It's safest to have it.  The best way to prove that your

Re: Support for export keyword to use with C++ templates ?

2010-02-03 Thread Paolo Bonzini
On 02/02/2010 05:04 AM, Michael Witten wrote: On Sun, Jan 31, 2010 at 6:38 PM, Paolo Carlini wrote: it's extremely unlikely that the C++ front-end maintainers could even consider reviewing patches from a novice for such an hard to implement feature. That says more about the tangled mess th

Re: Support for export keyword to use with C++ templates ?

2010-02-02 Thread Tim Prince
On 2/2/10 7:19 PM, Richard Kenner wrote: I see that what I need is an assignment for all future changes. If my employer is not involved with any contributions of mine, the employer disclaimer is not needed, right ? It's safest to have it. The best way to prove that your employer is not in

Re: Support for export keyword to use with C++ templates ?

2010-02-02 Thread Richard Kenner
> I see that what I need is an assignment for all future changes. If my > employer is not involved with any contributions of mine, the employer > disclaimer is not needed, right ? It's safest to have it. The best way to prove that your employer is not involved with any contributions of yours is w

Re: Support for export keyword to use with C++ templates ?

2010-02-02 Thread Timothy Madden
On Mon, Feb 1, 2010 at 2:38 AM, Paolo Carlini wrote: > On 02/01/2010 01:26 AM, Timothy Madden wrote: [...] > As I see the issue, you should first check over the next months that the > feature is not deprecated by ISO. I know, I tried to talk about it on std.c++. I am afraid I can not see a consens

Re: Support for export keyword to use with C++ templates ?

2010-02-01 Thread Michael Witten
On Sun, Jan 31, 2010 at 6:38 PM, Paolo Carlini wrote: > it's extremely > unlikely that the C++ front-end maintainers could even consider > reviewing patches from a novice for such an hard to implement feature. That says more about the tangled mess that is gcc then about any particular programmer'

Re: Support for export keyword to use with C++ templates ?

2010-01-31 Thread Ian Lance Taylor
Timothy Madden writes: > On Sat, Jan 30, 2010 at 4:05 AM, Paolo Carlini > wrote: > [...] >> Even for implementors knowing *very* well both the details of the C++ >> standard and the internals of a specific front-end, implementing export >> is an *highly* non-trivial task. [...] > > Yes, everyon

Re: Support for export keyword to use with C++ templates ?

2010-01-31 Thread Paolo Carlini
On 02/01/2010 01:26 AM, Timothy Madden wrote: > Since such a change must happen in small steps, I would be interested > to know how 'acceptable' would a limited implementation be at first ? > Like the command line options I have seen declared 'experimental' in > the gcc manual before ... > As I

Re: Support for export keyword to use with C++ templates ?

2010-01-31 Thread Timothy Madden
On Sat, Jan 30, 2010 at 4:05 AM, Paolo Carlini wrote: [...] > Even for implementors knowing *very* well both the details of the C++ > standard and the internals of a specific front-end, implementing export > is an *highly* non-trivial task. [...] Yes, everyone is telling me that, but could someon

Support for export keyword to use with C++ templates ?

2010-01-31 Thread Timothy Madden
On Sat, Jan 30, 2010 at 4:23 AM, Michael Witten [...] > However, I have a gut feeling that at least a restricted version of > 'export' (or a cousin of 'export') could be both useful and trivial to > implement: [...] > Those were my thoughts too. Since such a change must happen in small steps, I w

Re: Support for export keyword to use with C++ templates ?

2010-01-30 Thread Dodji Seketeli
On Sat, Jan 30, 2010 at 01:47:03AM +0200, Timothy Madden wrote: > So nobody here wants to try a big thing ? :( This question strikes me as being not very fair because many GCC people are already pretty much involved. Would you fancy giving a hand? > How long would it take for someone to understa

Re: Support for export keyword to use with C++ templates ?

2010-01-30 Thread Ian Lance Taylor
Paolo Carlini writes: > Anyway, modulo a possible deprecation (I believe M$ through Herb is > still pushing for it) I think the slightly more serious side of this > export thing is something Mark, if I'm not mistaken, said some time > ago, at the very beginning of the Lto ideas, to the effect th

Re: Support for export keyword to use with C++ templates ?

2010-01-30 Thread Paolo Carlini
Hi I already tried to tell him that upthread. Sorry about that, last night was tired and didn't follow the whole thread. Anyway, modulo a possible deprecation (I believe M$ through Herb is still pushing for it) I think the slightly more serious side of this export thing is something Ma

Re: Support for export keyword to use with C++ templates ?

2010-01-29 Thread Joe Buck
, or experience frequent corruption or the like; I've had such problems making such systems work that we've generally resorted to turning it off (e.g. tell Sun's compiler to expand templates into static functions). These problems might be overcome, but it hasn't been done

Re: Support for export keyword to use with C++ templates ?

2010-01-29 Thread Ian Lance Taylor
Paolo Carlini writes: > On 01/30/2010 01:14 AM, Ian Lance Taylor wrote: >> I don't think you need to understand the build system to implement >> export in C++. You do clearly need to understand the g++ frontend. >> However, it's impossible for me to estimate how long it would take >> somebody to

Re: Support for export keyword to use with C++ templates ?

2010-01-29 Thread Michael Witten
On Fri, Jan 29, 2010 at 8:05 PM, Paolo Carlini wrote: > Even for implementors knowing *very* well both the details of the C++ > standard and the internals of a specific front-end, implementing export > is an *highly* non-trivial task. However, I have a gut feeling that at least a restricted versi

Re: Support for export keyword to use with C++ templates ?

2010-01-29 Thread Paolo Carlini
On 01/30/2010 01:14 AM, Ian Lance Taylor wrote: > I don't think you need to understand the build system to implement > export in C++. You do clearly need to understand the g++ frontend. > However, it's impossible for me to estimate how long it would take > somebody to understand it. It would depe

Re: Support for export keyword to use with C++ templates ?

2010-01-29 Thread Ian Lance Taylor
Timothy Madden writes: > How long would it take for someone to understand how parsing works in > g++ ? Or to understand the build system in gcc ? I don't think you need to understand the build system to implement export in C++. You do clearly need to understand the g++ frontend. However, it's i

Re: Support for export keyword to use with C++ templates ?

2010-01-29 Thread Timothy Madden
On Mon, Jan 25, 2010 at 8:12 PM, Ian Lance Taylor wrote: > Timothy Madden writes: > >> On Fri, Jan 22, 2010 at 2:24 AM, Ian Lance Taylor wrote: >>> Timothy Madden writes: >>> Why is it so hard to store template definitions (and the set of symbols visible to them) in an object fil

Re: Support for export keyword to use with C++ templates ?

2010-01-25 Thread Ian Lance Taylor
Timothy Madden writes: > On Fri, Jan 22, 2010 at 2:24 AM, Ian Lance Taylor wrote: >> Timothy Madden writes: >> >>> Why is it so hard to store template definitions (and the set of >>> symbols visible to them) in an >>> object file, probably as a representation of the parsed template source >>>

Re: Support for export keyword to use with C++ templates ?

2010-01-22 Thread Timothy Madden
On Fri, Jan 22, 2010 at 2:24 AM, Ian Lance Taylor wrote: > Timothy Madden writes: > >> Is there any progress or start yet in implemententing export for C++ >> templates ? > > Not to my knowledge. > > The C++0x standards committee considered deprecating export for

Re: Support for export keyword to use with C++ templates ?

2010-01-21 Thread Ian Lance Taylor
Timothy Madden writes: > Is there any progress or start yet in implemententing export for C++ > templates ? Not to my knowledge. The C++0x standards committee considered deprecating export for C++0x, but I think they have decided to retain it for now. > Why is everybody such not i

Support for export keyword to use with C++ templates ?

2010-01-21 Thread Timothy Madden
Hello Is there any progress or start yet in implemententing export for C++ templates ? A search in the mailing list archive shows the last time the issue was discussed was in 2006. Why is everybody such not interested in this ? It would be such a great feature, especially for a leading C

Re: [variadic templates]feature request: n-th element of expansion

2009-11-25 Thread Larry Evans
On 11/19/09 18:28, Larry Evans wrote: On 11/19/09 17:23, Jason Merrill wrote: On 11/17/2009 09:36 AM, Larry Evans wrote: Could g++ provide this feature? How hard would it be to implement. It probably wouldn't be difficult to implement, but I'd want someone to champion the extension with the

Re: [variadic templates]feature request: n-th element of expansion

2009-11-19 Thread Larry Evans
pedef v...@n type; // or implementation_defined::type - > guaranteed linear > }; > template get_type::type get(V...v) { > return ::implementation_defined(v...); > } This is probably the most-requested feature for variadic templates, and it never it made it because we never found a good, u

Re: [variadic templates]feature request: n-th element of expansion

2009-11-19 Thread Jason Merrill
On 11/17/2009 09:36 AM, Larry Evans wrote: Could g++ provide this feature? How hard would it be to implement. It probably wouldn't be difficult to implement, but I'd want someone to champion the extension with the C++ committee as well. Have you asked Doug Gregor what he thinks? I assume th

[variadic templates]feature request: n-th element of expansion

2009-11-17 Thread Larry Evans
As mentioned in a post of comp.std.c++: http://preview.tinyurl.com/yaqvnnq there's a need for some way to get the nth element of a pack expansion. For example, boost::mpl::arg: http://www.boost.org/doc/libs/1_40_0/libs/mpl/doc/refmanual/arg.html wouldn't need the preprocessor for its impl

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Jonathan Wakely
2009/3/10 Sylvain Pion: > Manuel López-Ibáñez wrote: >> 2009/3/10 Sylvain Pion: >>> >>> Yes, but like any extension, it's nice to be able to disable them >>> as errors, so as to be able to use GCC for checking code portability. >> >> So use -pedantic-errors as it says in the manual. You should real

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Jason Merrill
-pedantic-errors will make it an error. I don't feel strongly about whether these should be pedwarn or something stronger, but I note that libstdc++ wants to use variadic templates in the default mode, so we can't just disable them entirely. Jason

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Gabriel Dos Reis
On Tue, Mar 10, 2009 at 7:57 AM, Manuel López-Ibáñez wrote: > 2009/3/10 Sylvain Pion : >>> >>> But then probably, variadic templates are implemented as a GCC >>> extension to C++98 and they work fine with -std=c++98 despite what the >>> warning says.

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Sylvain Pion
Gabriel Dos Reis wrote: On Tue, Mar 10, 2009 at 6:58 AM, Sylvain Pion wrote: Manuel López-Ibáñez wrote: 2009/3/10 Sylvain Pion : The problem I fear is that variadic templates are already conveniently used as an implementation detail in libstdc++. And the warning there is probably hidden by

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Sylvain Pion
Manuel López-Ibáñez wrote: 2009/3/10 Sylvain Pion : But then probably, variadic templates are implemented as a GCC extension to C++98 and they work fine with -std=c++98 despite what the warning says. Or don't they? Yes, but like any extension, it's nice to be able to disable them as

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Manuel López-Ibáñez
2009/3/10 Sylvain Pion : >> >> But then probably, variadic templates are implemented as a GCC >> extension to C++98 and they work fine with -std=c++98 despite what the >> warning says. Or don't they? > > Yes, but like any extension, it's nice to be able

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Gabriel Dos Reis
On Tue, Mar 10, 2009 at 6:58 AM, Sylvain Pion wrote: > Manuel López-Ibáñez wrote: >> >> 2009/3/10 Sylvain Pion : >>> >>> The problem I fear is that variadic templates are already conveniently >>> used as an implementation detail in libstdc++. And the w

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Sylvain Pion
Manuel López-Ibáñez wrote: 2009/3/10 Sylvain Pion : The problem I fear is that variadic templates are already conveniently used as an implementation detail in libstdc++. And the warning there is probably hidden by the "system header" warning removal machinery. But then probably

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Manuel López-Ibáñez
2009/3/10 Sylvain Pion : > > The problem I fear is that variadic templates are already conveniently > used as an implementation detail in libstdc++.  And the warning there > is probably hidden by the "system header" warning removal machinery. > But then probabl

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Paolo Carlini
Sylvain Pion wrote: > The problem I fear is that variadic templates are already conveniently > used as an implementation detail in libstdc++. And the warning there > is probably hidden by the "system header" warning removal machinery. It is, you are right. Paolo.

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Sylvain Pion
Jan van Dijk wrote: Consider the one-liner C++ 'program': template struct pack; With the trunk, g++ -c [-std=gnu++98] gives: warning: variadic templates only available with -std=c++0x or -std=gnu++0x Should this not be an *error* instead? Variadic templates really should not be

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Paolo Carlini
Manuel López-Ibáñez wrote: > In any case the wording of the warning is weird: it says variadic > templates are not available but then it is accepted with just a > warning. > I agree. >> to variadic templates. It also happens, for example, for: >> >> enum class e {

Re: variadic templates supported in non-c++0x mode

2009-03-10 Thread Manuel López-Ibáñez
2009/3/10 Paolo Carlini : >> >> warning: variadic templates only available with -std=c++0x or -std=gnu++0x >> > I'm afraid the behavior you are seeing is by design, and is not specific In any case the wording of the warning is weird: it says variadic templates are no

  1   2   >