public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53763] New: Missing error check on decltype when used within variadic template argument list
@ 2012-06-24 16:24 o.mangold at googlemail dot com
  2012-06-24 18:39 ` [Bug c++/53763] " daniel.kruegler at googlemail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: o.mangold at googlemail dot com @ 2012-06-24 16:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53763

             Bug #: 53763
           Summary: Missing error check on decltype when used within
                    variadic template argument list
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: o.mangold@googlemail.com


In the example below, which is invalid code, no appropriate compiler error is
reported. The code is wrong, because "decltype(A::a(2))" is invalid as A is a
template class and would need template arguments. 

The compiler seams to silently skip the function call to B::b as if it was not
there (it produces only a message for the first call of b). The only thing that
is reported, though, is that y is used uninitialized. Apparently a later stage
knows that the function was not called.

It seems necessary that B takes a variadic template argument list for the
problem to appear, but I couldn't nail it down further.

--- compiler output ---
> g++ -Wall -std=c++11 example.c
example.c: In function ‘int main()’:
example.c:26:12: warning: ‘y’ is used uninitialized in this function
[-Wuninitialized]

--- example.cxx ---
#include<stdio.h>

template<typename TYPE>
struct A
{
  static int a(TYPE value)
  {
    return value;
  }
};

template<typename... ARGS>
struct B
{
  static int b(ARGS... args)
  {
    printf("hello world %i\n",args...);
    return 0;
  }
};

int main()
{
  int x = B<decltype(A<int>::a(1))>::b(A<int>::a(1));
  int y = B<decltype(A     ::a(2))>::b(A<int>::a(2));
  return x+y;
}


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

* [Bug c++/53763] Missing error check on decltype when used within variadic template argument list
  2012-06-24 16:24 [Bug c++/53763] New: Missing error check on decltype when used within variadic template argument list o.mangold at googlemail dot com
@ 2012-06-24 18:39 ` daniel.kruegler at googlemail dot com
  2012-10-09 16:01 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-06-24 18:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53763

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-06-24 18:38:50 UTC ---
This problem seems not to exist in 4.8.x HEAD, the error message is:

"25|error: template argument 1 is invalid"


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

* [Bug c++/53763] Missing error check on decltype when used within variadic template argument list
  2012-06-24 16:24 [Bug c++/53763] New: Missing error check on decltype when used within variadic template argument list o.mangold at googlemail dot com
  2012-06-24 18:39 ` [Bug c++/53763] " daniel.kruegler at googlemail dot com
@ 2012-10-09 16:01 ` paolo.carlini at oracle dot com
  2012-10-09 16:10 ` paolo at gcc dot gnu.org
  2012-10-09 16:10 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-09 16:01 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53763

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com
   Target Milestone|---                         |4.8.0

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-09 16:01:06 UTC ---
Let's add the testcase and close this as fixed for 4.8.0.


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

* [Bug c++/53763] Missing error check on decltype when used within variadic template argument list
  2012-06-24 16:24 [Bug c++/53763] New: Missing error check on decltype when used within variadic template argument list o.mangold at googlemail dot com
                   ` (2 preceding siblings ...)
  2012-10-09 16:10 ` paolo at gcc dot gnu.org
@ 2012-10-09 16:10 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-09 16:10 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53763

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-09 16:10:22 UTC ---
Done.


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

* [Bug c++/53763] Missing error check on decltype when used within variadic template argument list
  2012-06-24 16:24 [Bug c++/53763] New: Missing error check on decltype when used within variadic template argument list o.mangold at googlemail dot com
  2012-06-24 18:39 ` [Bug c++/53763] " daniel.kruegler at googlemail dot com
  2012-10-09 16:01 ` paolo.carlini at oracle dot com
@ 2012-10-09 16:10 ` paolo at gcc dot gnu.org
  2012-10-09 16:10 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-10-09 16:10 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53763

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-10-09 16:09:39 UTC ---
Author: paolo
Date: Tue Oct  9 16:09:32 2012
New Revision: 192263

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192263
Log:
2012-10-09  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/53763
    * g++.dg/cpp0x/decltype43.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype43.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2012-10-09 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-24 16:24 [Bug c++/53763] New: Missing error check on decltype when used within variadic template argument list o.mangold at googlemail dot com
2012-06-24 18:39 ` [Bug c++/53763] " daniel.kruegler at googlemail dot com
2012-10-09 16:01 ` paolo.carlini at oracle dot com
2012-10-09 16:10 ` paolo at gcc dot gnu.org
2012-10-09 16:10 ` paolo.carlini at oracle dot com

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).