public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58047] New: parse error with typedef introduced from base class
@ 2013-08-01 16:17 roshan.shariff at gmail dot com
  2013-08-01 22:23 ` [Bug c++/58047] " paolo.carlini at oracle dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: roshan.shariff at gmail dot com @ 2013-08-01 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58047
           Summary: parse error with typedef introduced from base class
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roshan.shariff at gmail dot com

Created attachment 30585
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30585&action=edit
Test case exhibiting parse error

Trying to compile the attached code with g++ 4.8.1 gives an error. The code
compiles and works fine with clang.

template <int N>
struct print_arg {
  void print () { std::cout << N << '\n'; }
};

struct const_holder {
  static constexpr int CONSTANT = 42;
};

template <typename T>
struct identity {
  using type = T;
};

template <class T>
struct test_case : public identity<T> {
  using typename identity<T>::type;
  print_arg<type::CONSTANT> printer; // <- parse error
};

int main () {
  // Should print 42
  test_case<const_holder>().printer.print();
}

The attached file contains two variants of the above code that do work fine.
Trying to compile it produces the following error message:

$ g++ -std=c++11 gccbug.cpp -o gccbug
gccbug.cpp:31:3: error: parse error in template argument list
   print_arg<type::CONSTANT> printer;
   ^
gccbug.cpp: In instantiation of 'struct test_case<const_holder>':
gccbug.cpp:46:27:   required from here
gccbug.cpp:31:29: error: expected primary-expression
   print_arg<type::CONSTANT> printer;
                             ^
gccbug.cpp: In function 'int main()':
gccbug.cpp:46:29: error: 'struct test_case<const_holder>' has no member named
'printer'
   test_case<const_holder>().printer.print();


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

end of thread, other threads:[~2014-02-02 20:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-01 16:17 [Bug c++/58047] New: parse error with typedef introduced from base class roshan.shariff at gmail dot com
2013-08-01 22:23 ` [Bug c++/58047] " paolo.carlini at oracle dot com
2013-08-02  9:53 ` paolo.carlini at oracle dot com
2013-08-02  9:54 ` paolo.carlini at oracle dot com
2013-08-02 10:00 ` paolo.carlini at oracle dot com
2013-08-03 10:54 ` paolo.carlini at oracle dot com
2014-02-02 20:08 ` fabien at gcc dot gnu.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).